CoreData和iCloud [英] CoreData and iCloud

查看:189
本文介绍了CoreData和iCloud的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个核心数据应用程序,并正在考虑添加iCloud支持,但是在环顾四周之后,我经常听说iCloud + CoreData不可靠,并且会经常崩溃。



这是真的吗?我正在阅读一本关于核心数据主题的书,提到iCloud + CoreData在iOS 5中不可靠,但已经修复,但我也听说过相反,iCloud + CoreData在iOS 6中仍然不可靠。如果是这样,将存储

解决方案?



任何帮助将非常感谢。

现在iOS 7已经发布,我们可以谈论它。并且一切似乎表明在iOS 7 iCloud Core Data同步已经修复。我要将iCloud Core Data sync添加到我正在构建的(仅限iOS 7)应用程序中,因此我无法从个人体验中说出来,但我听到的一切都表明,它现在对黄金时间有好处。 / p>

我强烈建议您观看WWDC 2013的Core Data和iCloud的新功能会话视频:https://developer.apple.com/videos/wwdc/2013/?id=207 (需要Apple开发人员计划会员资格)。我现在已经看过两次了,他们肯定会让很多更简单。



最后,我建议你看看 GitHub上的UbiquityStoreManager 。它是一个图书馆,几乎所有的痛苦的部分为您的iCloud Core Data。它被修改以考虑到iOS 7的显着改进,虽然如果你想利用他们的应用程序必须是iOS 7(无论你是否使用库)。



更新:发布此答案后,我现在可以从个人经验中说出来,并且可以确认iOS 7中的Core Data iCloud Sync岩石坚固,更令人难以置信地容易实施。我将它添加到我的应用程序,而不使用 UbiquityStoreManager 或任何其他第三方库,这是非常简单。



编辑:我用iCloud Core数据堆栈为iOS 7创建了一个GitHub repo。希望它有帮助:
https://github.com/mluisbrown/iCloudCoreDataStack


I am developing a core data application and was thinking of adding iCloud support, but after looking around on the web I frequently heard that iCloud+CoreData is unreliable and will often break.

Is this true? A book I am reading on the subject of core data mentions that iCloud+CoreData was unreliable in iOS 5 but has since been fixed, however I have also heard the opposite, that iCloud+CoreData is still unreliable in iOS 6. If so would storing the database in a custom format help at all?

Any help would be greatly appreciated.

解决方案

Now that iOS 7 has been released, we can talk about it. And everything would seem to indicate that in iOS 7 iCloud Core Data sync has been fixed. I'm about to add iCloud Core Data sync to an (iOS 7 only) app I'm building, so I can't yet speak from personal experience, but everything I've heard suggests that it's now good for prime time.

I highly recommend watching the "What's New in Core Data and iCloud" session video from WWDC 2013: https://developer.apple.com/videos/wwdc/2013/?id=207 (requires an Apple Developer Program membership). I've watched it twice now, and they've certainly made things a lot more straightforward.

Lastly, I recommend taking a look at UbiquityStoreManager on GitHub. It's a library that pretty much does all the painful parts of iCloud Core Data for you. It's been modified to take into account the significant improvements in iOS 7, all though if you want to take advantage of them your app has to be iOS 7 only (that applies whether you use the library or not).

UPDATE: Since posting this answer, I now can speak from personal experience, and can confirm that Core Data iCloud Sync in iOS 7 is rock solid, and what's more, unbelievably easy to implement. I added it to my app without using UbiquityStoreManager or any other 3rd party library and it was very straightforward. Literally just a few lines of code.

EDIT: I created a GitHub repo with my iCloud Core Data stack for iOS 7. Hope it helps: https://github.com/mluisbrown/iCloudCoreDataStack

这篇关于CoreData和iCloud的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆