Store structured app and user data in iCloud containers that can be shared by all users of your app.
- iOS 8.0+
- macOS 10.10+
- tvOS 9.0+
- watchOS 3.0+
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.