Changes

Jump to: navigation, search

Synchronizing iOS 9 Key-Value Data using iCloud

16 bytes removed, 20:34, 1 February 2016
m
Text replacement - "<google>BUY_IOS9</google>" to "<htmlet>ios9</htmlet>"
<googlehtmlet>BUY_IOS9ios9</googlehtmlet>
An application may register to be notified when stored values are changed by another application instance. This is achieved by setting up an observer on the NSUbiquitousKeyValueStoreDidChangeExternallyNotification notification. This notification is triggered when a change is made to any key-value pair in a specified key value store and is passed an array of strings containing the keys that were changed together with an NSNumber indicating the reason for the change. In the event that the available space for the key-value storage has been exceeded this number will match the NSUbiquitousKeyValueStoreQuotaViolationChange constant value.
<googlehtmlet>BUY_IOS9ios9</googlehtmlet>
== An iCloud Key-Value Data Storage Example ==
}
</pre>
<googlehtmlet>BUY_IOS9ios9</googlehtmlet>
The method begins by allocating and initializing an instance of the NSUbiquitousKeyValueStore class and assigning it to the keyStore variable. Next, the stringForKey method of the keyStore object is called to check if the MyString key is already in the key-value store. If the key exists, the string value is assigned to the text property of the text field object via the textField outlet.
<googlehtmlet>BUY_IOS9ios9</googlehtmlet>

Navigation menu