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
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to