NSUserDefaults and KVO issues

I suggest making use of the appropriate notification: NSUserDefaultsDidChangeNotification.

Search for AppPrefs in the Apple Documentation within Xcode and it’ll show an example app which does exactly what you want to do. Just compile and run! It makes use of the NSUserDefaultsDidChangeNotification.

This is the code being used to register an observer:

[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(defaultsChanged:)
                                             name:NSUserDefaultsDidChangeNotification
                                           object:nil];

Leave a Comment