I am preparing to submit my app to the App Store. From the research I've done, it seems that there is no easy way to move records from CloudKit's Development environment to its Production environment. According to this answer (Move record from development to production in CloudKit?), I need to download all my records in Development to some sort of file and then upload them to Production. Can someone break down this process for me a bit more? How am I supposed to download these records? What kind of file am I supposed to make? I don't understand. Thanks!
There is no method that you're "supposed" to use, because there's no supported method of migrating data across environments. There is no "file" that you can download and simply re-upload. The normal path expected by Apple is: create a schema in the dev env, create test records in the dev environment, deploy the schema to the prod environment, then start all over with new records in the prod env. Since that path doesn't preserve data across envs, you're pretty much on your own to find a way to preserve the data yourself.
The answer you referenced is suggesting to use this approach (https://stackoverflow.com/a/40414108/1641444) to switching between dev and prod environments in order to do the following:
How you choose to save the data in step 3 will depend on how many records you have, what types of data they store, and which methods of saving/retrieving data you're familiar with. Personally, I have SQL database in my app, so I'd probably just create new tables and store the records there. You could open another question describing the schema/data you're working with and ask for ideas on how to save it on the device and later re-read it.
Also, you can only migrate the privateDB records for the iCloud account that's logged into the device. If you've used the development builds with multiple iCloud accounts, each one will need to repeat the process in order to migrate all of their private DB records.
The other alternative, if you don't have too many records and don't have binary data, is to manually create new records in the prod database using the cloudkit dashboard.
If you have a complex schema with lots of record types and/or field types, steps 2, 3, 5 and 6 could be very difficult (or at least, very time consuming) to code.
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