CloudKit
Store structured app and user data in iCloud containers that all users of your app can share.
Overview
The CloudKit framework provides interfaces for moving data between your app and your iCloud containers. You use CloudKit to store your app’s existing data 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 isn’t 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 only necessary 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 Operation objects to manage the asynchronous transfer of data to and from the server.
Before using CloudKit, make sure it’s the most suitable option for your app. For more information, see Deciding whether CloudKit is right for your app.
Topics
Essentials
Schemas
Designing and Creating a CloudKit DatabaseManaging iCloud Containers with CloudKit Database AppCKRecordZoneCKRecordCKRecord.ReferenceCKAssetIntegrating a Text-Based Schema into Your Workflow
Records
User discovery
Core objects
Privacy
Encrypting User DataProviding User Access to CloudKit DataChanging Access Controls on User DataCKFetchWebAuthTokenOperationResponding to Requests to Delete DataIdentifying an App’s Containers
Errors
CKErrorDomainCKErrorCKError.CodeCKErrorRetryAfterKeyCKErrorUserDidResetEncryptedDataKeyCKPartialErrorsByItemIDKeyRecord Changed Error Keys