两个应用程序(iPhone 和 iPad)之间的 Core Data iCloud 同步
几天前,我向苹果提交了我的第一个 iPad 应用程序。与此同时,它的 iPhone 版本也即将准备就绪。我想使用 iCloud 来同步两个应用程序之间的核心数据模型。可以这样做吗?正如我所写,这是两个不同的应用程序(不是通用应用程序),它们使用具有相同结构的核心数据存储:名称、实体和属性相同。可以这样做吗?我需要更改核心数据模型中的任何内容吗?我在想,如果我必须对其进行根本性的更改,那么在审核之前从 iTunes Connect 中删除二进制文件会更方便,而不是事后进行困难的迁移更改。有什么建议吗?
I submitted my first iPad app to apple a few days ago. In the meantime the iPhone version of it is almost ready. I would like to use iCloud to synchronize the core data model between both apps. Is it possible to do this? As I wrote, these are two different applications (not a universal app) that use a core data store with the same structure: names, entities and attributes are the same. Is it possible to do this? Do I have to change anything in the core data model? I was thinking that if I have to do radical changes to it, it would be more convenient to remove the binary from iTunes Connect before it gets reviewed instead of having to do difficult migration changes afterwards. Any tips?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
iCloud 对 Core Data 的支持实际上应该是自动的。不过,您确实需要做一些额外的工作来设置同步并响应通过云发生的更改(刷新 UI 等)。只要您没有使用 iOS5 中引入的新有序关系(iCloud 不支持),您就不必更改模型。
其他需要考虑的事情是您计划存储的数据量以及您是否在每个设备上使用初始数据集播种核心数据。
话虽如此,通过 iCloud 的 Core Data 是一项新技术,早期采用者仍然存在一些问题需要解决。 Apple 还没有提供示例代码,也没有许多关于最佳实践的指南。如果我是你,我会犹豫不决立即这样做。
查看 Core Data/iCloud 发行说明< /a>.
iCloud's support for Core Data is supposed to be virtually automatic. You do have to do some extra work though to set up syncing and to respond to changes as they occur via the cloud (refresh UI etc). You shouldn't have to change your model as long as you haven't used the new ordered relationships introduced in iOS5 (not supported via iCloud).
Other things to think about are the amount of data you are planning to store and whether you are seeding Core Data with an initial data set on each device.
Having said all that, Core Data via iCloud is new technology and there are still some issues to be ironed out by the early adopters. There is no sample code from Apple yet or many guidelines on best practice. If I were you I would hang back from doing this straight away.
Take a look at the Core Data/iCloud release notes.