lhunath/UbiquityStoreManager — pull request #44 by Clstroud (2014-01-16 04:18:58+00:00)
Title: Draft implementation of UbiquityStoreManagerBackupPolicy

Adds UbiquityStoreManagerBackupPolicy as a type which can be used to configure whether or not backups should occur under varying circumstances.

UbiquityStoreManager now has a "backupPolicy" property and corresponding dictionary key that allow the developer to configure the circumstance(s), if any, that they would like their Core Data storage to be backed up to iCloud/iTunes.

The options are:

· **UbiquityStoreBackupPolicyAlways** - persistent store will be backed up to iCloud or iTunes
· **UbiquityStoreBackupPolicyLocalOnly** - persistent store will be permitted to back up ONLY if iCloud Sync is disabled
· **UbiquityStoreBackupPolicyNever** - persistent store will never be backed up to iCloud or iTunes

Many developers likely haven't needed this feature because their Core Data stores remain relatively small. However, with External Storage having been introduced in iOS 5+, certain scenarios may lead to enormous "support" files attempting to be synced across the network and into iCloud, which is clearly sub-optimal, especially if that data is already being synced by iCloud.

**Note:** I did refactor some of the constants and typedef declarations to be closer in line with *my* personal understanding of what Apple encourages. Due to style preferences (or wrongness on my part) I completely understand if those changes aren't desirable for some reason. Also, this seems to work fine for me in my app's environment but I'm certain there are edge cases out there somewhere that I am not aware of and can't anticipate… but I tried my best to keep it non-invasive :-) It may make more sense to deny this PR and clone the branch into your repository rather than merging into master. Not quite sure what the standard protocol is for a contributor attempting to hand over an experimental feature rather than a quick bug fix.