Jordi Corominas
Jordi Corominas

Reputation: 1244

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. 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.

$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.

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:

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.

So, I'll start looking for alternatives... If I find any I'll keep you updated :(

Upvotes: 1

Views: 579

Answers (1)

Rob Glassey
Rob Glassey

Reputation: 2257

This is a bug. Which may or may not be fixed in an upcoming release of iOS. Search on NSPersistentStoreDidImportUbiquitousContentChangesNotification, and you may find some of the crazy solutions people have tried already. 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. Since I've went an entirely different route I've no idea if that is about to get fixed.

Upvotes: 2

Related Questions