[SOLVED] NSUbiquitousKeyValueStoreDidChangeExternallyNotification
[SOLVED] NSUbiquitousKeyValueStoreDidChangeExternallyNotification
- Subject: [SOLVED] NSUbiquitousKeyValueStoreDidChangeExternallyNotification
- From: Paul Scott <email@hidden>
- Date: Fri, 19 Oct 2012 00:28:46 -0700
I spent days checking out everything to no avail. Both devices using the same iCloud account, entitlements and provisioning profile in order, code correct, waiting patiently for a notification: nada. In total frustration I powered off both devices and restarted them.
VoilĂ !
Now I'm getting notifications consistently, and reasonably quickly.
Thank you all for all the helpful tips.
Paul
> I must be missing something very basic, but I cannot get iCloud KV storage to work. I've really perused the documentation on many fronts, but I'm still stumped.
>
> My app's provisioning profile is configured for iCloud, all the correct entitlements are set, and I can even see the the Ubiquity "Documents" container in iCloud. But for the life of me, I cannot get any changes to KV storage to propagate to iCloud, or get a notification back if a KV item changed.
>
> I register for a notification:
>
> NSUbiquitousKeyValueStore* store = [NSUbiquitousKeyValueStore defaultStore];
> if ( store ) {
> [[NSNotificationCenter defaultCenter] addObserver:self
> selector:@selector(updateKVStoreItems:)
> name:NSUbiquitousKeyValueStoreDidChangeExternallyNotification
> object:store];
> }
>
> The first time the app writes to NSUbiquitousKeyValueStore, I do get the NSUbiquitousKeyValueStoreInitialSyncChange notification. After that, I never receive any notifications again on that device when the the same app running on another device changes the NSUbiquitousKeyValueStore (or the same app running on the same device for that matter).
>
> For example, this only drives the notification on the initial call, even though many keys in[NSUserDefaults standardUserDefaults] have corresponding changed values:
>
> NSUbiquitousKeyValueStore* store = [NSUbiquitousKeyValueStore defaultStore];
> if ( store ) {
> [store setDictionary:[[NSUserDefaults standardUserDefaults] dictionaryRepresentation] forKey:@"DictionaryTest"];
> }
>
> The app is obviously configured correctly, or I would not see any Ubiquity documents in the iCloud Developer Web site. It's the KV storage I can't get to work, or rather I never receive any change notifications for Ubiquity KV storage.
>
> Apple has done a remarkable job of simplifying the developer's tasks. But, maybe I've oversimplified it, 'cuz it ain't workin' for me! Any clues what I'm missing?
>
> Paul
>
> Sent from my iPad
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden