Deploying an iCloud Container’s Schema
Reset your container’s state during development and deploy your container’s schema to production.
Overview
During initial development of your app, you create your schema and add records for testing in the development environment. Apps in the App Store can access only the production environment. Before you publish your app, you must deploy the development schema to the production environment to copy over its record types, fields, and indexes.
As you continue to develop your app, you can add record types and fields to the development environment. To prevent conflicts, you can’t delete record types or fields that are already in production. Every time you deploy the development schema, its additive changes merge into the production schema. For testing purposes, your app in development can access either the development or the production environment.
[Image]
Reset the development environment
You can reset the development environment in the CloudKit Database app between runs of your app to remove all records. If your schema isn’t in production, resetting the development environment also deletes all record types. Otherwise, the development schema reverts to the state of the production environment.
To reset the development environment to the current state of production:
Sign in to CloudKit Console at https://icloud.developer.apple.com/.
Select the CloudKit Database app.
In the top section, choose your app’s container from the list.
On the left of the screen, select Reset Environment.
In the dialog that appears, read the warning, select the checkbox, and click Reset.
[Image]
Deploy the development schema
After you finalize your schema and test your app in the development environment, you’re ready to deploy the schema to production in the CloudKit Database app. Deploying the schema copies its record types, fields, and indexes to the production environment, but doesn’t copy any records. After deployment, you can populate the production environment with records as necessary, and test your app there.
To deploy the development schema to production:
Sign in to CloudKit Console at https://icloud.developer.apple.com/.
Select the CloudKit Database app.
In the top section, choose your container from the list.
On the left, select Deploy Schema Changes.
Review the pending deployment changes and click Deploy.
[Image]