Created
August 30, 2013 05:38
-
-
Save Marlunes/6386612 to your computer and use it in GitHub Desktop.
Ignore iCloud Backup
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
//call this after download or after saving a file | |
//Example: [self addSkipBackupAttributeToItemAtURL:[NSURL fileUrlWithPath:@"your path here"]]; | |
- (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){ | |
NSLog(@"Error excluding %@ from backup %@", [URL lastPathComponent], error); | |
}else{ | |
NSLog(@"Success!"); | |
} | |
return success; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment