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.

Était-ce utile?

La 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;
}
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top