I am planning to ship a CoreData application, but I am unsure if introducing iCloud functionality. This question come after I have been beta testing my app on iPhone, filling it with relevant data.
I then added iCloud functionality and start testing on iPad. I discovered that only new entry were sync between devices, this are the tentatives I did:
- Working on iPhone, fill data, enable iCloud, start working on empty iPad
But I got some weird problems, such as child entities attached to wrong parent. Then I tried this.
- Export application documents from iPhone and import in iPad
In this case data are the same on both devices, but I still wasn’t able to synchronize old data, while new one get perfectly sync most of the time after seconds.
I understand that CoreData sync happen with transaction log exchange, so it could be obvious that old data do not get sync. But at this point I am asking if someone has already faced this problem which seems quite common to me, or if I am missing something, some kind of settings or lines of code to make this working as expected.
I don’t think you have missed anything. The basic problem is that having a pre-stocked database isn’t supported by iCloud. Its something thats been troubling me too.
From the doc’s
https://developer.apple.com/library/ios/#releasenotes/DataManagement/RN-iCloudCoreData/_index.html
I haven’t tried using the migratePersistentStore:… method yet for my work but the key fact seems to be that the transmission of core-data across iCloud via the transaction logs relies on every transaction from the birth of the database being tracked by the mechanism.
I would assume that using migratePersistentStore:… will cause a big seeding blob of transactions to hit the system.