[英]CoreData with iCloud: Receiving empty data on NSPersistentStoreDidImportUbiquitousContentChangesNotification
We are developing an App that uses iCloud to store CoreData file and shares this data between an iPhone and an iPad. 我们正在开发一个使用iCloud存储CoreData文件并在iPhone和iPad之间共享此数据的应用程序。 When receiving a data update done on the other device, through NSPersistentStoreDidImportUbiquitousContentChangesNotification, sometimes, the update is empty even though there was a valid change on the other device to cause the update to be sent. 当通过NSPersistentStoreDidImportUbiquitousContentChangesNotification接收另一台设备上完成的数据更新时,即使另一台设备上存在有效更改以致导致发送更新,更新有时还是空的。
$0 = 0x1f5c64e0 NSConcreteNotification 0x1f5c64e0 {name = com.apple.coredata.ubiquity.importer.didfinishimport; object = <NSPersistentStoreCoordinator: 0x1f553130>; userInfo = {
deleted = "{(\n)}";
inserted = "{(\n)}";
updated = "{(\n)}";
}}
This is not happening always, it seems to be absolutely random but when happens both ManagedObjects (from iPhone and iPad) have different data. 这种情况并非总是会发生,似乎绝对是随机的,但是当两种情况(来自iPhone和iPad)的ManagedObjects具有不同的数据时,这种情况就不会发生。
Does anybody know why is this happening and whats the meaning of receiving this collections empty? 有人知道为什么会这样吗?收到这些收藏品的含义是什么? Is this a bug or something? 这是错误还是什么?
UPDATE AFTER CONTACTING APPLE 接触苹果后更新
Well, I contacted Apple through the DTS service (you have 2 technical support requests every year included with your subscription) and after pretty much sending them the same text I wrote here I received this answer: 好吧,我通过DTS服务与Apple联系(您的订阅中每年包含2个技术支持请求),并且在向他们发送与我在此处写的相同文字之后,我收到了以下答案:
Hello Jordi, 你好乔迪,
Thank you for contacting Apple Developer Technical Support. 感谢您与Apple开发人员技术支持联系。 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 . 请使用位于http://bugreport.apple.com的Bug Reporter工具提交有关此问题的完整bug报告。
So, I'll start looking for alternatives... If I find any I'll keep you updated :( 因此,我将开始寻找替代方案...如果找到任何替代方案,我将为您提供最新信息:(
This is a bug. 这是一个错误。 Which may or may not be fixed in an upcoming release of iOS. 在即将发布的iOS版本中可能修复或未修复的问题。 Search on NSPersistentStoreDidImportUbiquitousContentChangesNotification
, and you may find some of the crazy solutions people have tried already. 搜索NSPersistentStoreDidImportUbiquitousContentChangesNotification
,您可能会发现人们已经尝试过的一些疯狂的解决方案。 The notification seems to come through malformed, but since you only get the notification once, you never receive one containing the correct data, so in effect you lose data. 该通知似乎格式不正确,但是由于您只收到一次通知,因此您永远不会收到包含正确数据的通知,因此实际上会丢失数据。 Personally, this (and this was the final straw), along with a number of other intractable issues killed off my attempts at getting Core Data sync over iCloud working using Apple's method. 就个人而言,这(也是最后的稻草),以及其他许多棘手的问题,使我无法使用Apple的方法在iCloud上实现Core Data同步的尝试被扼杀了。 Since I've went an entirely different route I've no idea if that is about to get fixed. 由于我走了一条完全不同的路线,所以我不知道这是否会解决。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.