Changes

Jump to: navigation, search

An iOS 9 CloudKit Subscription Example

16 bytes removed, 20:34, 1 February 2016
m
Text replacement - "<google>BUY_IOS9</google>" to "<htmlet>ios9</htmlet>"
<googlehtmlet>BUY_IOS9ios9</googlehtmlet>
Once the CKSubscription is fully configured, it is committed to the cloud database using the saveSubscription method of the cloud database object. For the purposes of this example, the code to implement the subscription should be implemented in the viewDidLoad method located in the ViewController.swift file:
<googlehtmlet>BUY_IOS9ios9</googlehtmlet>
<pre>
override func viewDidLoad() {
The method begins by obtaining a reference to the root view controller of the application. The code then extracts the CKNotification object from the NSDictionary that was passed to the method by the operating system. The notificationType property of the CKNotification object is then checked to make sure it matches CKNotificationType.Query (which indicates that the notification was triggered as a result of a subscription).
<googlehtmlet>BUY_IOS9ios9</googlehtmlet>
The record ID is then obtained and passed to the fetchRecord method on the view controller. The next step is to implement the fetchRecord method.
<googlehtmlet>BUY_IOS9ios9</googlehtmlet>

Navigation menu