According to the developer documentation on Apple's website: https://developer.apple.com/library/ios/#qa/qa1719/_index.html
Starting in iOS 5.0.1 a new "do not back up" file attribute has been introduced allowing developers to clearly specify which files should be backed up. (com.apple.MobileBackup)
I'm wondering if this is supported in PhoneGap / Cordova, as I want to be able to store some offline data (data that can be downloaded or otherwise recreated, but that the user expects to be reliably available when offline) that is not backed up on iCloud.
Persistance is clearly documented (LocalFileSystem.PERSISTENT - http://docs.phonegap.com/en/1.5.0/phonegap_file_file.md.html#LocalFileSystem) on the PhoneGap website, but there seems to be no way of ensuring a saved file is not backed up to the iCloud.
I'm still holding out for a solution within PhoneGap / Cordova but as a temporary work around...
In my AppDelegate init:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
// Get documents directory
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *formularyPath = [documentsDirectory stringByAppendingPathComponent:@"OfflineData"];
if (![[NSFileManager defaultManager] fileExistsAtPath:formularyPath])
[[NSFileManager defaultManager] createDirectoryAtPath:formularyPath withIntermediateDirectories:NO attributes:nil error:nil];
// Prevent iCloud backup
u_int8_t b = 1;
setxattr([formularyPath fileSystemRepresentation], "com.apple.MobileBackup", &b, 1, 0, 0);
Don't forget #import "sys/xattr.h"
This creates a new folder under documents and sets the no backup attribute.
You can then save your files in PhoneGap using the persisted local file store option and files saved in your new subdirectory will not be backed up.