iOS Developer Library — Prerelease


CloudKit Framework Reference

CloudKit Framework Reference

Classes   Protocols   Other Reference  

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.



NSObject is the root class of most Objective-C class hierarchies.


A CKAsset object represents a large file associated with a record.


A CKContainer object encapsulates content associated with an app, including content that is publicly accessible to all users of the app and content that is private to a specific user.


A CKDatabase object is a conduit for accessing the public and private data of an app container.


A CKDiscoveredUserInfo object contains information about a discoverable user in a database.


A CKNotification object represents a push notification that was sent to your app.


A CKQueryNotification object represents a push notification that was generated by a subscription object.


A CKRecordZoneNotification object represents a push notification that was caused by changes to the contents of a record zone.


A CKNotificationID object uniquely identifies a push notification sent from a container.


A CKNotificationInfo object specifies the push notification data that the server sends to your app when a subscription finds a match.


A CKQuery object manages the criteria to apply when searching for records in a database.


A CKQueryCursor object is an opaque data object that marks the stopping point for a query and the starting point for retrieving the remaining results.


A CKRecord object is a dictionary of key-value pairs that you use to fetch and save the data of your app.


A CKRecordID object uniquely identifies a record in a database.


A CKRecordZone object defines an area for organizing related records in a database.


A CKRecordZoneID object uniquely identifies a record zone in a database.


A CKReference object creates a many-to-one relationship between records in your database.


A CKServerChangeToken object is an opaque data object that identifies a specific version of a record.


Use a CKSubscription object to track changes occurring on the server.


The NSOperation class is an abstract class you use to encapsulate the code and data associated with a single task.


The CKOperation class is the abstract base class for all operations executed against a CloudKit database.


The CKDatabaseOperation class is an abstract parent class for operations that act on the public or private databases in a container.


A CKFetchRecordChangesOperation object reports on the changed and deleted records in the specified record zone.


A CKFetchRecordZonesOperation object retrieves CKRecordZone objects (whose IDs you already know) from iCloud.


A CKFetchRecordsOperation object retrieves CKRecord objects (whose IDs you already know) from iCloud.


A CKFetchSubscriptionsOperation object retrieves CKSubscription objects (whose IDs you already know) from iCloud and can fetch all subscriptions associated with the current user.



A CKModifyRecordZonesOperation object saves or deletes record zones.


A CKModifyRecordsOperation object saves changes to one or more CKRecord objects.


A CKModifySubscriptionsOperation object saves changes to one or more CKSubscription objects.


A CKQueryOperation object is a concrete operation that you can use to execute queries against a database.


A CKDiscoverAllContactsOperation object retrieves the IDs of all discoverable users that are also in the user’s address book.


A CKDiscoverUserInfosOperation object retrieves the IDs for discoverable users whose email addresses or user record IDs you already know.


A CKFetchNotificationChangesOperation object retrieves unread CKNotification objects from a container.


A CKMarkNotificationsReadOperation object marks push notifications as read by your app so that they do not show up in future fetch results.


A CKModifyBadgeOperation object updates the badge value applied to the app’s icon.


An instance of NSSortDescriptor describes a basis for ordering objects by specifying the property to use to compare the objects, the method to use to compare the properties, and whether the comparison should be ascending or descending.


A CKLocationSortDescriptor object sorts records containing location data based on their distance from a location that you specify.



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

Other Reference

CloudKit Framework Constants Reference