Search code examples
iosswifticloudkey-value

iCloud Key Value Storage Changes Not Called (NSUbiquitousKeyValueStoreDidChangeExternallyNotification)


NSUbiquitousKeyValueStoreDidChangeExternallyNotification Does not get called at all?

var keyStore: NSUbiquitousKeyValueStore?

viewDidLoad{

NSNotificationCenter.defaultCenter().addObserver(self,
            selector: "ubiquitousKeyValueStoreDidChange:",
            name: NSUbiquitousKeyValueStoreDidChangeExternallyNotification,
            object: keyStore)



userDefinedLabelOne.text = keyStore?.stringForKey("userDefinedStringOne") <---this is changed

 }





func ubiquitousKeyValueStoreDidChange(notification: NSNotification) {

     println("Changed")  <---- Not called


    }

Already checked here iCloud Key-Value-Store Synchronization issues (NSUbiquitousKeyValueStoreDidChangeExternallyNotification not called)

Key value storage selected in iCloud capabilities

CloudKit sharing data ok

The data is saved to the cloud but notifications of changes are not being called


Solution

  • By signing out of iCloud accounts and back in all started working correctly