Question

I am doing one application.In that i am creating the .txt files in DocumentDirectory at runtime.But they will backup to icloud.SO now i want to stop the backup in before ios 5 versions.From ios 5 onwards we have option to stop the back up process.I want to store the files in documents and not back up in before 5.0 versions.

Was it helpful?

Solution

If you have installed ios version prior then ios5 then no data will backup to cloud. Becouse i-cloud comes with ios5.

In ios5.0 you can stop your backup with following function

(BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL {
    NSLog(@"in add skipBackUpAtrribute method.......");
    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;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top