Adding CloudKit to your project

First, make sure the Xcode project is set up correctly. Note that the project files in this book's code bundle have been modified in preparation of this chapter. If you want to follow along with the steps in this chapter, make sure to grab the MustC starter project for this chapter from the code bundle. You need to have a unique bundle identifier for the MustC app. The code bundle that goes with this book uses a bundle identifier of com.donnywals.MustC. Make sure that you change this to something unique. Also, make sure that you have selected a valid developer team under Xcode's signing options. Refer to the following screenshot to see an example of what your General settings should look like:

Next, open the Capabilities tab in the project settings. Scroll down until you see the iCloud capability. Make sure to toggle it so it's turned on and expand the iCloud section. Check the CloudKit checkbox to enable CloudKit for your application, as shown in the following screenshot:

Toggling the iCloud capability has added an entitlements file to your project. This file is coupled to your Xcode signing identity and it makes sure that your app is allowed to use certain capabilities. You should not make manual changes to this file because Xcode will automatically ensure that it matches the Capabilities tab in your project settings.

Note that enabling iCloud and CloudKit also turns on the Push Notifications entitlement. This entitlement was added to your application so it can receive notifications about changes in your CloudKit database in the background. You'll learn more about this later in the chapter.

Technically this is all you need to do to add CloudKit to your app. Before you learn how to perform read and write operations on your CloudKit database, you should familiarize yourself with the heart of your CloudKit backend, the dashboard.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.14.70.203