Before you can use the CloudKit in an iOS application, you must add the CloudKit entitlements in the project. You can use your own iOS project or this starter project, CloudKitGuide. Steps presented below assume you will use the starter project.
Now, here are the steps to add the CloudKit entitlements in the starter project.
- Click the General tab.
- Change the Bundle Identifier name to your reverse domain name, and select your name from the Team menu.
- Click the Capabilities tab.
- Flick the iCloud switch ON and tick the CloudKit checkbox.
After execute step 3 and 4, the iCloud section should look like this now:
By performing above steps, Xcode added an entitlements file and the CloudKit framework in the project. Xcode also created a container in the CloudKit Dashboard. To access it, click the Dashboard button in the Capabilities tab.
By the way, the Single View Application template was used to create the starter project, with these options. So the container’s name in the CloudKit Dashboard is called “CloudKitGuide”