使用iCloud在多个设备上同步核心数据

问题描述:

很多最近讨论了关于iCloud和Core Data的问题以及Apple的API目前在iOS 5和iOS 6中是如何被破坏的。

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.

是否有可能,鉴于Apple的核心数据API的当前状态,使用iCloud在多个设备之间可靠地同步?

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.

这取决于你想做什么。有两种类型的Core Data-iCloud集成,如下所述: http://developer.apple.com/library/ios/#releasenotes/DataManagement/RN-iCloudCoreData/_index.html

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


从广义上讲,有两种类型的基于核心数据的应用程序与iCloud集成:

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.

基于文档的应用程序,其中可以在应用程序的生命周期中的不同时间打开不同的文档。
这种应用方式的例子是Keynote和Numbers。

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.

如果您使用的是库类型,本文是系列中的第一个涉及很多问题的系列: http://mentalfaculty.tumblr.com/post/23163747823/under-the-sheets-with-icloud-and-core-data-the-basics

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.

您还可以查看今年wwdc的会议218(基于文档)或227(库类型)。

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