simple backup of coredata database to icloud. how?

I have a coredata database. I want to provide a simple backup and restore features. for that i am planning to backup the database from time to time. the user can restore from last backups. apart from the .sql database do i need to backup anything more? what icloud api should i use to back it up?

Replies

I think it depends on size and sharing (is it a shared database or an individual database). The simplest is to use the key-value file in iCloud. That will take a small database and share it only among that one user's devices. Next is to use CloudKit and store it in the private space. That will take a much larger database and share it, again, amongst the devices owned by that user. Using a CKAsset you could store a very large database. Finally, you could use the public database and allow all users of the app to share the databse. All of this is explained here:


https://developer.apple.com/library/archive/documentation/DataManagement/Conceptual/CloudKitQuickStart/Introduction/Introduction.html#//apple_ref/doc/uid/TP40014987-CH1-SW1