1

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 :(

Jordi Corominas
  • 1,244
  • 10
  • 15

1 Answers1

2

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.

Rob Glassey
  • 2,237
  • 20
  • 21
  • Could you give me any link of this "crazy" solutions? – Jordi Corominas Aug 07 '13 at 10:46
  • Looking very quickly: [1](https://devforums.apple.com/thread/179938), [2](https://devforums.apple.com/message/808998), [3](http://stackoverflow.com/questions/10194023/relational-integrity-and-validation-in-core-data-icloud-syncing), [4](http://stackoverflow.com/questions/9346503/icloud-sync-not-sending-data-through-ubiquity-container). The crazy solution I can recall, if I remember correctly, was to perform every transaction twice or something, but I don't believe anything like that will actually work. Or detect it happening and ask the user to wipe and rebuild their iCloud store. – Rob Glassey Aug 07 '13 at 11:09
  • And [this thread](https://devforums.apple.com/message/827177#827177) might be relevant with regards to how fixed this issue should soon be. – Rob Glassey Aug 07 '13 at 11:36
  • Rob, it's hard to believe that it's just a bug and I've read several people reporting similar problems that are more than a year old. Why do you thing this has not been resolved (or deprecated) yet? And another thing... in our case this is happening in a particular table more usually than on the others, how could this be possible? – Jordi Corominas Aug 07 '13 at 13:18
  • I can't answer that. If that is the same issue that stumped me, I couldn't get past it. Many more prestigious names than me within the iOS/Mac development community have failed to get Core Data over iCloud working in any sort of reliable way that let them incorporate it into their products. Have you read: [1](http://www.theverge.com/2013/3/26/4148628/why-doesnt-icloud-just-work), [2](http://arstechnica.com/apple/2013/03/frustrated-with-icloud-apples-developer-community-speaks-up-en-masse/), or [3](http://rms2.tumblr.com/post/46505165521/the-gathering-storm-our-travails-with-icloud-sync)? – Rob Glassey Aug 07 '13 at 14:12