Recover consumables (coins) in swift 2

I am creating a consumable coin quiz to use. I used NSUserDefault to save coins to the device and its operation. I also use CloudKit for data in qiuz.

No problem, how to restore coins if the user switches the device? There is part of the solution with keychain, but it only works on one device.

Is there a way to store coins through the control panel in a cloud sheet with my data?

Thanks in advance

+4
source share
1 answer

iCloud. , NSUserDefaults, " " NSUserDefaults.

" iCloud" Apple

NSUserDefaults , iCloud.

: " " . . ** enter image description here **

: didFinishLaunchingWithOptions: NSUbiquitousKeyValueStoreDidChangeExternallyNotification NSNotificationCenter.

: NSUbiquitousKeyValueStore.defaultStore() , NSUserDefaults.

( , ..)

, , Key-Value, , ... Apple Guide.

+1

All Articles