Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save jazzedge/07d9ec261a02cc2e4dd40d2a974c11e7 to your computer and use it in GitHub Desktop.

Select an option

Save jazzedge/07d9ec261a02cc2e4dd40d2a974c11e7 to your computer and use it in GitHub Desktop.
Optionally, configure your app to use multiple containers or share a container with other apps. For example, you might use one app internally to create record types and records programmatically to return a database to a known state. This app needs to share the same container as the end-user app you are developing and testing. To do this, you ena…
See: https://developer.apple.com/library/content/documentation/DataManagement/Conceptual/CloudKitQuickStart/EnablingiCloudandConfiguringCloudKit/EnablingiCloudandConfiguringCloudKit.html#//apple_ref/doc/uid/TP40014987-CH2-SW1
01. Add Containers to an App
Select an existing container ID used by another app or create a new one.
To add a container to an app
A. In the Capabilities pane under the iCloud settings, select “Specify custom containers.”
When you previously selected the CloudKit service, Xcode created a default container ID for your
app that matches the bundle ID. A checkmark appears next to the default container ID.
B. If necessary, click the Refresh button below the Containers table to download containers from
your developer account that are used by other apps.
C. In the row of the container ID you want to add, select the checkbox.
Xcode updates the list of container IDs in the entitlements file.
02. Create Custom Containers
Alternatively, create a custom container shared by multiple apps.
To create a custom container
A. If "Use default container” is selected, select “Specify custom containers.”
B. Click the Add button (+) at the bottom of the table.
C. In the dialog that appears, enter an identifier for the container you want to add.
Warning: You can’t delete a container ID, so choose the container ID carefully.
A container ID begins with iCloud. followed by a string in reverse DNS notation.
D. Click OK.
Xcode adds the new container ID to the Xcode project entitlements file and to your developer account
If you want to share the new container ID with another app, add the container to the app, as described
in Add Containers to an App.
03. Verify Your Steps
You can view all the container IDs for your team in the Capabilities pane in Xcode or
your developer account. In your developer account, you can also add containers and edit the
name of containers.
To view container IDs in your developer account
Go to Certificates, Identifiers & Profiles and for Mac apps, choose OS X from the
pop-up menu on the left.
Under Identifiers, select iCloud Containers.
Optionally, in the upper right corner, click the search button and enter text in the search field.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment