Store structured app and user data in iCloud containers that can be shared by all users of your app.


The CloudKit framework provides interfaces for moving data between your app and your iCloud containers. You use CloudKit to take your app’s existing data and store it in the cloud so that the user can access it on multiple devices. You can also store data in a public area where all users can access it.

Using the CloudKit Framework

CloudKit is not a replacement for your app’s existing data objects. Instead, CloudKit provides complementary services for managing the transfer of data to and from iCloud servers. Because it provides minimal offline caching support, CloudKit relies on the presence of the network and optionally a valid iCloud account. (A valid iCloud account is required only when you want to save data that is specific to a single user.) Apps can always store data in a public area that is readable by all users.

Records are at the heart of all data transactions in CloudKit. A record is a dictionary of key-value pairs that represents the data you want to save. You can add new keys and values to records at any time, and you can create links between related records to organize your data. The CKRecord class defines the interfaces for managing the contents of records. CloudKit also relies heavily on the use of NSOperation objects to manage the asynchronous transfer of data to and from the server.

For information about getting started with CloudKit, see CloudKit Quick Start.



At the core of the CloudKit framework lies the record. Nearly every action performed with CloudKit impacts the record object in some meaningful way.


A dictionary of key-value pairs that you use to fetch and save your app's data.


The definition of a custom area for organizing related records in a database.


A reference used to create a many-to-one relationship between records in a database.


The protocol that provides strong type checking for objects that the CloudKit framework stores on the server.

Record Operations

Asynchronously fetch or modify records.


To keep record sizes manageable, all large elements associated with a record are stored in an asset.


An object representing a large file associated with a record.


Queries are used to search for records in CloudKit.


An operation used to execute queries against a database.


A query that describes the criteria to apply when searching for records in a database.


An object that marks the stopping point for a query and the starting point for retrieving the remaining results.


An object used to sort records containing location data.

Notifications and Subscriptions

You can get information about changes on another device by subscribing to notifications.


The abstract base class for CloudKit subscriptions.


A notification that is triggered by changes to the contents of a record zone.


A notification that is triggered by changes to the contents of a database.


Notifications are used to inform your application of changes made by another device.

Subscription Operations

Subscriptions are used to request notifications of specific subsets of data changes.

Shared Content

In addition to making data public, you can share records with a subset of users of an app.


A reference to a shared record.


A reference to the metadata for a shared record.


A reference to a person who accepted a shared record.

Share Operations

Operations are used to communicate shared information with CloudKit.

Database Management

Supporting records are a number of structures that segregate data for different purposes.


An encapsulation of content associated with an app.


A conduit for accessing and performing operations on the data of an app container.


A reference to a user.


An object that represents information you use to fetch users.


Constants indicating the permissions granted to the app by the user.

Database Operations

Operations used to look up users and maintain the state of the app's badge.

User Data Management

Providing User Access to CloudKit Data

Give users access to the data your app stores on their behalf.

Changing Access Controls on User Data

Restrict access to or lift restrictions on a user's data at their request.

Responding to Requests to Delete Data

Provide options for users to delete their CloudKit data from your app.

Identifying an App's Containers

Use Xcode's project navigator to find the identifiers of active CloudKit containers.


While working with CloudKit, you can access data from a web browser.


This operation fetches a web authentication token given an API token using an API token that you provide.


As with all distributed systems, it is possible to have errors occur while trying to access data in CloudKit.


Error codes that are returned by CloudKit.


The domain for CloudKit errors. This constant is used whenever an NSError is thrown with regard to an error generated by CloudKit.

See Also