Data Management Best Practices
Store all user data in the cloud. Shared iPad requires a cloud-based synchronization model for any data required to persist between uses of the app. Send data to your own backend using NSURLSession, or use iCloud, NSUbiquitousKeyValueStore and store credentials in Keychain.
Fetch remote data on demand. Since all data associated with a given app may not be required at any given time, develop a download strategy that ensures you only download what’s needed when it’s needed or just before. Rather than bringing back all known user content you may need in the app, consider only pulling what’s required in the current context.
Sync data as it changes. Sync user entered or created data as you get it. Be sure to synchronize during applicationWillResignActive at the minimum, but keep in mind that waiting too long or holding an overly large batch for synchronization will provide an inferior user experience and may lead to data loss in rare cases.
Store first launch or progress flags in the cloud. If your app determines the need for a first launch experience based on a flag currently stored in the local file system or NSUserDefaults, you should move these per user flags to NSUbiquitousKeyValueStore and check there before presenting your first launch experience.
For more information on the NSUbiquitousKeyValueStore, check out the NSUbiquitousKeyValueStore Class Reference and PrefsInCloud sample project.
Limit background task assertion requirements. Limit the amount of work you do in background task assertions to the minimum needed to ensure data consistency and synchronization — generally calls to NSURLSession or iCloud APIs to upload the user’s data. These APIs provide support to continue the network operation without blocking the transition between users.
Indicate purgeable local storage support in your project PList. Indicate support for Shared iPad by setting the NSSupportsPurgeableLocalStorage key to “yes” in your project’s Info.plist. Doing so indicates that your app supports having its local data purged when the user logs out.