3
votes

Users have reported that, when they restore a device from an iCloud (as opposed to an iTunes) backup, the data for my app is not restored. It is not clear to me the steps I need to take to ensure that my app data is restored when the entire device is restored from an iCloud backup.

I do not have iCloud enabled in app capabilities; is this one of the steps I need to take to make sure my data is included in the restore? What are the other steps I need to take and things I need to check?

More info: I have a Core Data app and store a .sqlite file. I store my file in [[UIApplication sharedDelegate] applicationDocumentsDirectory]. I use NSUserDefaults. My app doesn't appear in any list for iCloud within Settings.

1

1 Answers

1
votes

You do not have to include iCloud capabilities. iCloud backs up automatically what is saved into DocumentsDirectory and also saves NSUserDefaults.

Bear in mind that for those datas you don't want to be included in iCloud, you must add - (BOOL)addSkipBackupAttributeToItemAtPath:(NSString *) filePathString flag. Apple is very strict with this backup and you must save only user-generated content, or else app will be rejected.

Important: Apps should avoid mingling app data and user data in the same file. Doing so will unnecessarily increase backup sizes and can be considered a violation of the iOS Data Storage Guidelines.

To check how much space your app use in iCloud Backup (and figure out if your data is saved or not) you can check here:

- Install and launch your app
- Go to Settings > iCloud > Storage > Manage Storage
- Select your device
- If necessary, tap "Show all apps"
- Check your app's storage

If you know your app should store bigger data you will see there but please note that what is under 100-150kb is from NSUserDefaults

Let me know if you have more questions.