Created
November 9, 2014 08:50
-
-
Save kankikuchi/076fafd0246e527e6b00 to your computer and use it in GitHub Desktop.
Library/PreferencesをiCloudのバックアップ対象から外す
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//バックアップ対象から外す | |
- (NSString *)myDocumentsPath | |
{ | |
NSString *documentsPath = [NSHomeDirectory() stringByAppendingPathComponent:@"Library/Preferences"]; | |
return documentsPath; | |
} | |
- (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL | |
{ | |
assert([[NSFileManager defaultManager] fileExistsAtPath: [URL path]]); | |
NSError *error = nil; | |
BOOL success = [URL setResourceValue: [NSNumber numberWithBool: YES] | |
forKey: NSURLIsExcludedFromBackupKey error: &error]; | |
if(success){ | |
CCLOG(@"Skip %@", URL); | |
} | |
else{ | |
NSLog(@"Error excluding %@ from backup %@", [URL lastPathComponent], error); | |
} | |
return success; | |
} | |
- (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL | |
{ | |
//バックアップ無効 | |
NSString *filePath = [self myDocumentsPath]; | |
NSURL *dirUrl = [NSURL fileURLWithPath:filePath]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment