Changes

Jump to: navigation, search

An Introduction to CloudKit Data Storage on iOS 9

16 bytes removed, 20:34, 1 February 2016
m
Text replacement - "<google>BUY_IOS9</google>" to "<htmlet>ios9</htmlet>"
<googlehtmlet>BUY_IOS9ios9</googlehtmlet>
}))
</pre>
<googlehtmlet>BUY_IOS9ios9</googlehtmlet>
The method call passes through the record to be saved and specifies a completion handler in the form of a closure expression to be called when the operation returns. It is important to understand that CloudKit operations are predominantly asynchronous, enabling the calling application to continue to function while the CloudKit Framework works in the background to handle the transfer of data to and from the iCloud servers. In most cases, therefore, a call to CloudKit API methods will require that a completion handler be provided. This handler code will then be executed when the corresponding operation completes and passed results data where appropriate, or an error object in the event of a failure. Given the asynchronous nature of CloudKit operations, it is important to implement robust error handling within the completion handler.
CloudKit subscriptions allow users to be notified when a change occurs within the cloud databases belonging to an installed app. Subscriptions use the standard iOS push notifications infrastructure and can be triggered based on a variety of criteria such as when records are added, updated or deleted. Notifications can also be further refined using predicates so that notifications are based on data in a record matching certain criteria. When a notification arrives, it is presented to the user in the same way as other notifications through an alert or a notification entry on the lock screen.
<googlehtmlet>BUY_IOS9ios9</googlehtmlet>
CloudKit subscriptions are configured using the CKSubscription class and are covered in detail in the chapter entitled [[An iOS 9 CloudKit Subscription Example]].
<googlehtmlet>BUY_IOS9ios9</googlehtmlet>

Navigation menu