Created
November 22, 2012 09:10
-
-
Save leecrossley/4130115 to your computer and use it in GitHub Desktop.
Don't back up anything on iCloud, ever.
This file contains hidden or 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* doc = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]; | |
NSString* lib = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) objectAtIndex:0]; | |
float version = [[[UIDevice currentDevice] systemVersion] floatValue]; | |
if (version < 5.1) | |
{ | |
u_int8_t b = 1; | |
setxattr([doc fileSystemRepresentation], "com.apple.MobileBackup", &b, 1, 0, 0); | |
setxattr([lib fileSystemRepresentation], "com.apple.MobileBackup", &b, 1, 0, 0); | |
} | |
else | |
{ | |
NSURL* url = [NSURL fileURLWithPath:doc]; | |
[url setResourceValue: [NSNumber numberWithBool: YES] forKey: NSURLIsExcludedFromBackupKey error: Nil]; | |
url = [NSURL fileURLWithPath:lib]; | |
[url setResourceValue: [NSNumber numberWithBool: YES] forKey: NSURLIsExcludedFromBackupKey error: Nil]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment