Search code examples
ioscore-dataios6synchronizationicloud

Syncing Core Data across multiple devices using iCloud


There has been a lot of discussion lately about the issues with iCloud and Core Data and how Apple's APIs are currently broken in iOS 5 and possibly iOS 6.

Is it possible, given the current state of Apple's Core Data API, to reliably sync across multiple devices using iCloud?

If so, how would you do this? If not, please recommend an alternative approach.


Solution

  • It depends on what you want to do. There are two types of Core Data-iCloud integration, as described here: http://developer.apple.com/library/ios/#releasenotes/DataManagement/RN-iCloudCoreData/_index.html

    There are broadly speaking two types of Core Data-based application that integrate with iCloud:

    Library-style applications, where the application usually has a single persistent store, and data from the store is used throughout the application. Examples of this style of application are Music and Photos.

    Document-based applications, where different documents may be opened at different times during the lifetime of the application. Examples of this style of application are Keynote and Numbers.

    If you're using the library-type, this article is the first of a series that goes into a lot of the problems that will come up: http://mentalfaculty.tumblr.com/post/23163747823/under-the-sheets-with-icloud-and-core-data-the-basics.

    You can also check out sessions 218 (for document-based) or 227 (for library-style) of this year's wwdc.