10

I created a simple Notes app based on Core data. Now i want add sync between user devices.

And all articles that i read (this, this) said that i should fully get rid of my core data database, and all my code will lost and rework all with ICloud kit?

The is no way to sync data from Core Data to ICloud ? And if i get rid of core data, how my app will work offline ?

And please suggest good simple projects with ICloud sync

P.S. I googled about an hour. Icloud is deprecated so do sync with it is not recommended. I confused. How now i can sync data between devices??

Arti
  • 7,356
  • 12
  • 57
  • 122
  • can check one of this: https://www.youtube.com/watch?v=4kG3ujYzwv0 https://developer.apple.com/library/content/documentation/General/Conceptual/iCloudDesignGuide/Chapters/DesignForCoreDataIniCloud.html – Satish Mavani Nov 29 '16 at 12:09
  • @SatishMavani yes i saw it, but it is on obj c:( and it is hard to convert it... – Arti Nov 29 '16 at 12:33

1 Answers1

1

Core Data used to have iCloud syncing, but it has been deprecated as of iOS 10. It had several problems, sometimes major.

Apple now has something called CloudKit, which is not the same thing. You can use CloudKit to sync data between devices. But this does not mean that you should drop Core Data. CloudKit only syncs; it is not a replacement for having your app save data on the device, it's only a way to send data to other devices. If you're using CloudKit, you also need to use some other way to store data on the local device.

Also, it's "CloudKit". Not "ICloud Kit". I don't know why, but it's important to get the names right.

Tom Harrington
  • 69,312
  • 10
  • 146
  • 170
  • Thank you. But is there any examples how to use `CloudKit` with 'Core data' objects for sync. Because i don't understand. For example i have obect Person. I send it to cloud with some `CloudKit` function. Then on other device that doesn't have internet access i created 3 Persons. Then how do i sync all this data? `Icloud` do this with some magic. I don't know how. – Arti Nov 29 '16 at 18:09
  • I don't think **any** sync mechanism will send data to a device that, as you say "doesn't have internet access". How do you expect to get any data into or out of that device? – Tom Harrington Nov 29 '16 at 18:38
  • No, i mean when device will connect to internet. It should sync local data. – Arti Nov 29 '16 at 18:46
  • Apple provides [a sample CloudKit app](https://developer.apple.com/library/content/samplecode/CloudAtlas/Introduction/Intro.html) as well as [detailed, extensive CloudKit documentation](https://developer.apple.com/library/content/documentation/DataManagement/Conceptual/CloudKitQuickStart/Introduction/Introduction.html). If that's not enough, they provide [even more detailed documentation](https://developer.apple.com/reference/cloudkit). – Tom Harrington Nov 29 '16 at 19:19