Search code examples
iosicloudnsubiquitouskeyvaluestore

iCloud key-value store behaving like NSUserDefaults


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.


Solution

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