ios - 带有 iCloud 的 CoreData : Receiving empty data on NSPersistentStoreDidImportUbiquitousContentChangesNotification

标签 ios objective-c core-data icloud

我们正在开发一款使用 iCloud 存储 CoreData 文件并在 iPhone 和 iPad 之间共享此数据的应用程序。当通过 NSPersistentStoreDidImportUbiquitousContentChangesNotification 接收在另一台设备上完成的数据更新时,有时即使另一台设备上存在有效更改导致发送更新,更新也是空的。

$0 = 0x1f5c64e0 NSConcreteNotification 0x1f5c64e0 {name = com.apple.coredata.ubiquity.importer.didfinishimport; object = <NSPersistentStoreCoordinator: 0x1f553130>; userInfo = {
deleted = "{(\n)}";
inserted = "{(\n)}";
updated = "{(\n)}";
}}

这并不总是发生,它似乎是绝对随机的,但当发生时,两个 ManagedObjects(来自 iPhone 和 iPad)具有不同的数据。

有谁知道为什么会发生这种情况,接收这个集合是空的是什么意思?这是错误还是什么?

联系苹果后更新

好吧,我通过 DTS 服务联系了 Apple(你每年有 2 个技术支持请求包含在你的订阅中)并且在几乎向他们发送了我在这里写的相同文本之后我收到了这个答案:

Hello Jordi,

Thank you for contacting Apple Developer Technical Support. Our engineers have reviewed your request and have determined that this would be best handled as a bug report.

Please submit a complete bug report regarding this issue using the Bug Reporter tool at http://bugreport.apple.com.

所以,我将开始寻找替代方案...如果我找到任何替代方案,我会及时通知您 :(

最佳答案

这是一个错误。在即将发布的 iOS 版本中可能会修复也可能不会修复。搜索 NSPersistentStoreDidImportUbiquitousContentChangesNotification,您可能会发现一些人们已经尝试过的疯狂解决方案。通知似乎格式错误,但由于您只收到一次通知,您永远不会收到包含正确数据的通知,因此实际上您丢失了数据。就个人而言,这个(这是最后一根稻草)以及其他一些棘手的问题扼杀了我使用 Apple 的方法通过 iCloud 同步 Core Data 的尝试。因为我走了一条完全不同的路线,所以我不知道这个问题是否会得到解决。

关于ios - 带有 iCloud 的 CoreData : Receiving empty data on NSPersistentStoreDidImportUbiquitousContentChangesNotification,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18084790/

相关文章:

ios - 如何从 Storyboard的给定图像中选择颜色?

objective-c - 为什么 Objective-C 不支持私有(private)方法?

objective-c - 将记录类型返回到 applescript(来自 objective-C)

objective-c - 从数组中移动的对象未保存在核心数据中

ios - 核心数据 : Insert and delete with To many relationship

iphone - 如果在 iPad 上查看,iOS 6 Smart Banner for Phone 应用程序会显示在网站上吗?

objective-c - 如何找到两个 NSString 的共同模式?

ios - CBCentralManagerDelegate 没有在 NSObject 中被调用

iphone - 如何通过parentviewcontroller将数据从一个 View 传递到另一个 View

xcode - 如何在Xcode数据建模工具中重新排列实体属性?