Skip to content

Instantly share code, notes, and snippets.

@kankikuchi
Created November 9, 2014 08:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kankikuchi/076fafd0246e527e6b00 to your computer and use it in GitHub Desktop.
Save kankikuchi/076fafd0246e527e6b00 to your computer and use it in GitHub Desktop.
Library/PreferencesをiCloudのバックアップ対象から外す
//バックアップ対象から外す
- (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