Skip to content
This repository has been archived by the owner on Mar 4, 2020. It is now read-only.

specify the default key-value store object as the object of the notification? #8

Open
rsaunders100 opened this issue Apr 10, 2012 · 1 comment

Comments

@rsaunders100
Copy link

In the docs for NSUbiquitousKeyValueStore it states:

Important When you register for the NSUbiquitousKeyValueStoreDidChangeExternallyNotification notification, always specify the default key-value store object as the object of the notification.

@rastersize
Copy link

With that Apple refers to the object returned by +[NSUbiquitousKeyValueStore defaultStore]. This means that you must/should do the following when registering for the NSUbiquitousKeyValueStoreDidChangeExternallyNotification notification:

NSUbiquitousKeyValueStore *store = [NSUbiquitousKeyValueStore defaultStore];
NSNotificationCenter *notifCenter = [NSNotificationCenter defaultCenter];
[notifCenter addObserver:__the_observer__
                selector:@selector(handleNotif:)
                    name:NSUbiquitousKeyValueStoreDidChangeExternallyNotification
                  object:store];

Most likely to ensure that you only receive notifications that you are actually interested in. Unfortunately the "original" MKiCloudSync code (i.e. this repo) does not do this, and a few other things (see issue/pull request #5). Instead I would recommend using pandamonia’s a2’s fork (edit 2013-01-24: same repo the guy just changed his username) instead which not only registers for the notification correctly but also fixes a bunch of other issues (such as which keys to sync).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants