I am downloading many audio and video files and stored them in my Home directory. Now i want to "prevent backup to iCloud" so i have added following code for my every file's url
- (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL
{
const char* filePath = [[URL path] fileSystemRepresentation];
const char* attrName = "com.apple.MobileBackup";
u_int8_t attrValue = 1;
int result = setxattr(filePath, attrName, &attrValue, sizeof(attrValue), 0, 0);
return result == 0;
}
Can anyone tell me that will this code work for all IOS versions. if not then please suggest the correct way to do this. Thank You
No, it doesn't. In its Technical Note introducing the "do not backup" flag, Apple clearly states that
They also tell you what you need to do for older iOS versions:
You can use this code for iOS 5.1 or later