CloudKit is an API to interact with iCloud Drive, iCloud CoreData and iCloud Photo Library. Its supported on both iOS and OS X. It needs an iCloud account for read/write access because it don't have any persistent memory of its own. CloudKit supports Public and Private databases with both Structured and Bulk data. Key components of the CloudKit are;
As other conventional DBs CloudKit also use the queries to fetch data, i.e. CKQuery. Its consist of RecordType, NSPredicate and NSSortDescriptors.
To save devices resources we can also run our query asynchronously on iCloud server, by using CKSubscription. Its consist of RecordType, NSPredicate and Push (via Apple Push Service)
CloudKit don't expose user's account details (like email, user name,..) for the sake of privacy. For user mapping iCloud expose stable UUID based on a user and an app Container. An app can ask for permission to the user details. An app can also ask for permission to the user's contacts (have the iCloud account) to enable sharing capabilities.
App can also use iCloud Key-Value Store for storing (up to 1 MB) configuration data, preferences, and small amounts of app-related data.
- Containers encapsulates content associated with an app, including both public and private data. It coordinates all interactions between your app and the server. Its exposed as CKContainer object. It can be managed by WWDR portal. Its namespace should be unique like your app identifier.
- Databases - is a channel to access the public and private data of an app container. Every app have two kinda databases, ie;
- Public Database - It have shared data with read-only anonymous access with data saved on developer quota (i.e; 1 Petabyte)
- Private Database - It have current user's data so it needs an iCloud account for writing and use current user's quota which depends on users iCloud plan
- Records - is a dictionary of key-value pairs that you use to fetch and save the structured data with just-in-time schema. It can also have a metadata with change tag associated with it. It can save NSString, NSNumber, NSData, NSDate, CLLocation, CKRefrence, CKAsset and An array of all of them
- Record Zones - is a virtual grouping of Records, it can be custom.
- Record Identifiers - uniquely identifies a custom created record zone in a database. They also represents the location of a record.
- References - are the relationship(can be many-to-one) between objects. It is allowed to create circular owning references for a set of records. It supports cascade deletes so its recommended to do Back References.
- Assets - are large files associated with records. Alike Records we can use Asset objects to incorporate huge external files such as images, sound files, video files. Assets are saved as files on iCloud and owned by a Record.
- Operational - in-depth access to CloudKit
- Conventional - peaceful for general usage
As other conventional DBs CloudKit also use the queries to fetch data, i.e. CKQuery. Its consist of RecordType, NSPredicate and NSSortDescriptors.
To save devices resources we can also run our query asynchronously on iCloud server, by using CKSubscription. Its consist of RecordType, NSPredicate and Push (via Apple Push Service)
CloudKit don't expose user's account details (like email, user name,..) for the sake of privacy. For user mapping iCloud expose stable UUID based on a user and an app Container. An app can ask for permission to the user details. An app can also ask for permission to the user's contacts (have the iCloud account) to enable sharing capabilities.
App can also use iCloud Key-Value Store for storing (up to 1 MB) configuration data, preferences, and small amounts of app-related data.
Post a Comment