Question

I am subscribing to NSUbiquitousKeyValueStoreDidChangeExternallyNotification to monitor key value changes from iCloud. When received, I process the userinfo included and apply my business logic.

However, sometimes (especially on first launch) I am receiving keys that seem system-related, or at least are not part of my application -

AppleKeyboards
NSInterfaceStyle
AppleKeyboardsExpanded
AppleICUForce24HourTimeAirPlayShouldShowDebugButtonInPicker

etc

  1. How can I identify such keys and avoid trying to run them against my application code? Should i somehow be 'flagging' my own data so that they can be identified?
  2. Am I responsible for updating the local values for these keys? iCloud must be sending them for a reason, but I don't know where to put them. Are they in my NSUserDefaults? Or is iCloud handling them separately (in which case it seems strange they are included in the user info)?

This is how I subscribe to notifications:

[[NSNotificationCenter defaultCenter] addObserver:self                                                   selector:@selector(iCloudStoreChanged:)
                                             name:NSUbiquitousKeyValueStoreDidChangeExternallyNotification
                                           object:store];
Was it helpful?

Solution

Julien had it right here. I was not using any frameworks bit forgot that previously I had used MKiCloudSync to sync my NSUserDefaults. I can only assume these keys are added to NSUserDefaults by the system and were propogated to iCloud.

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