NSPersistantStoreCoordinator - addPersistentStoreWithType - 无处可去?
我想我已经开始在 iPhone 和 Mac 应用程序中集成 iCloud 了。 有时,设备之间偶尔会同步!
但我发现当应用程序崩溃时,任何更改都不再同步到 iCloud 存储。
一旦 Mac 版本崩溃,我就无法再次启动 - 并且当它在方法内运行 [psc addPersistentStoreWithType:configuration:URL:options:error:]
时似乎会陷入困境 - < 。
我没有收到任何错误,它只是无限期地坐在那里(这是在 mac 版本上)
还有一个单独的问题 - 我是否正确理解我不能使用现有数据库并期望它出现在 iCloud 存储上 - 我将不得不了解如何通过应用程序导入它或将其迁移到新的 sqlite 数据库中(例如我对 iCloud 存储所做的更改)?
感谢您的帮助,
亚当
I think I am starting to get somewhere with iCloud integration in my iPhone and Mac apps.
Sometimes things are occasionally syncing between the devices!
But I find that when the apps do crash that any changes are no longer sync to the iCloud storage.
And once the Mac version crashes I can't get it going again - and seems to get stuck when it reaches running the [psc addPersistentStoreWithType:configuration:URL:options:error:]
inside the method - (NSPersistentStoreCoordinator *)persistentStoreCoordinator
I don't get any errors, it just sits there indefinitely (This is on the mac version).
Also a separate issue - am I correct in understanding that I can't use an existing database and expect it to appear on the iCloud storage - I will have to some how import it or migrate it into the new sqlite db via the app (for the changes to me made onto the iCloud storage)?
Thanks for any help,
Adam
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我对此问题的解决方案是,如果无处不在的目录中尚不存在文件夹,则将 NSPersistentStoreUbiquitousContentNameKey 设置为 UUID。只要该目录仍然存在,就在其他客户端中使用此 UUID,否则生成一个新的。
My solution to this problem is to set NSPersistentStoreUbiquitousContentNameKey to a UUID if a folder doesn't already exist in the ubiquity directory. Use this UUID in other clients as long as the directory still exists, otherwise generate a new one.