Search code examples
sqlitecore-dataicloudios-app-group

How to sync sqlite database with iCloud?


I have searched weeks and found a lot similar questions, but they are all a few years ago. I don't know if it can work in now days.

I have a sqlite file in app group container, and I wanna sync it with iCloud. Is that happed? Or I have to change to CoreData?

Any help or reference links will be appreciate


Solution

  • SQLite really doesn't support this kind of thing. You could put the SQLite file in a cloud-synced folder, but the database would probably either be corrupted or else lose recent changes, depending on what iCloud decided to do. It would not be reliable and might just lose all the data without warning.

    Core Data with CloudKit is one way to solve this. There are others, for example Firebase. What's best really depends on the details of what you need, both in your app and in terms of server support.