kas-kad
kas-kad

Reputation: 3764

CloudKit: backup all server data? Any solutions?

this month we are going to release our first CloudKit based app. It can sync data between a few users, a few users can work with shared data. Since we care about user data, we are looking for some way to make regular backup copies of cloud data. I haven't found any backup options in CloudKit Dashboard so I wondering if there is a thirdparty solution anyone of you using in your apps? Or if there isn't any, I will consider to make my own backup tool. Any suggestions are appreciated.

Upvotes: 2

Views: 919

Answers (3)

farktronix
farktronix

Reputation: 3950

There isn't currently a way to back up data from the public database.

UPDATE: As Ramon mentioned, you can use the CloudKit Web Service API to access the public database from your server.

Data in the private database is stored in the user's account, and as a developer you don't have access to that data. Backing up private database data is not possible.

Upvotes: 0

Ramon
Ramon

Reputation: 8424

You can use CloudKit Web Services to access public database data from your own server.

Upvotes: 0

adamek
adamek

Reputation: 2644

  1. Create a new record type (maybe name it Archive?). Add an asset type field to that record type.

  2. In your app, fetch all of the records you want to backup.

  3. In your app, convert them all into a NSData object. Perhaps use NSJSONSerialization if you want a user-readable format?

  4. Attach that data to the asset field of an Archive record type CKRecord and upload that record from your app.

  5. The asset field can now be downloaded as a file from the CloudKit Dashboard.

Upvotes: 2

Related Questions