Question

I'm not using the simulator. Everything seems to be working fine in code. I can read and write to NSUbiquitousKeyValueStore, and it persists data between app runs.

[[NSUbiquitousKeyValueStore defaultStore] synchronize]

returns TRUE. However, updates never arrive at other devices, and if I delete the app from one device and reinstall it, NSUbiquitousKeyValueStore is wiped clean. Essentially, it's behaving like an alias of NSUserDefaults. I have entitlements setup, and iCloud is enabled in the provisioning portal. My target settings have Enable iCloud and Key-Value Store checked, with "Use store with identifier" set to my apps bundle identifier. I have one entry in "Ubiquity Containers" that is also my bundle name. Is there something that I'm missing? Configuration? An initialization step? Thanks.

Was it helpful?

Solution 2

My co-worker pointed out that I have to enable Documents & Data in the iCloud settings. This solved the problem.

OTHER TIPS

Are you registering for the NSUbiquitousKeyValueStoreDidChangeExternallyNotification notification and handling the NSUbiquitousKeyValueStoreInitialSyncChange case? When first launching the app, what you write to NSUbiquitousKeyValueStore might be getting undone because an "initial sync" with iCloud has not happened, in which case you will get that notification with a NSUbiquitousKeyValueStoreChangeReasonKey parameter holding the value NSUbiquitousKeyValueStoreInitialSyncChange

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top