Some years ago Apple released the iCloud sync of Core Data apps. Then I released an app for iPad / iPhone / MAC with a shared model using the new Apple mechanism. Things have not gone as expected. The sync mechanism sometimes doesn't work. For example, the last months, in my case, rarely the sync ends well through my 3 devices. Uploading objects in general works fine. But the download process of new or deleted objects normaly crash. Apple released some time ago a way to force the devices to redownload ALL the objects of the model (NSPersistentStoreRebuildFromUbiquitousContentOption) that normaly works but it's not an acceptable solution.
My questions: Does someone have accomplished to get iCloud + Core Data working fine? What about running iCloud+CD under iOS 9 + El capitan, any experience?
I'm evaluating migrate to new CloudKIT API but I don't like the idea of self-manage an object upload if the device is offline. Does the new mechanism of push notifications indicating model changes works fine?
Thanks
This is a question I've researched deeply in these last few months, I'm afraid without a definitive answer.
Here's what I can tell you from my experience:
If you, like me, don't want to start over with CloudKit, which works reliably but requires you to manually handle much of the syncing work and the conversion of CKRecords to ManagedObjects, give Ensembles.io a chance: it's working very well for me, the layer between Core Data and iCloud really is working in my case, where CD+iCloud didn't. I'm using the 1.0 version, which is open source and supports iCloud as one of its possible backends (and version 2.0, paid, supports even more); in a few days I got reliable sync with automatic de-duplication (you have to provide a uniqueIdentifier property to have it working, but I already had something in place...). The only issue I haven't figured out yet: sometimes (1 case out of 10, I'd say) an object doesn't sync right away when edited or deleted, but it always get on the other device when another object is added, edited or deleted: nothing got lost and everything has been handled "automatically" for me when these delays occurred, but still, I'd prefer that everything always synced right away. Ensembles also has a good logging for debug, something you'll appreciate coming from vanilla CD+iCloud. If you want to give it a try, you should take a look at these resources:
If you are absolutely sure that you don't want layers / third party code between Core Data and iCloud (I thought so myself, but I've changed my mind when I realized I lost three months of my life and got nothing in return), the implementations of Core Data + iCloud that I've found online and looked more promising were these:
I haven't tried myself these last two solutions, because my last plan of attack was to try Ensembles and, if it didn't work for me, go with those approaches. Since Ensembles has been very good to me, I didn't need to try them, but again they looked solid.
One last thought that bothers me: in 2015 WWDC sessions there's no mention of Core Data + iCloud. This, to me, spells doom for the syncing solution we're choosing.
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With