On Nov 13, 2016, at 15:24:44, Quincey Morris 
<quinceymor...@rivergatesoftware.com> wrote:
> 
> Is this a new thread, or a continuation of the one we had a couple of weeks 
> ago (IIRC)?

Brand new thread. I didn't see anything before.

> NSUserDefaults is not documented as KVO compliant for any of its properties. 
> You really shouldn’t try to observe them. Or are you really observing 
> NSUserDefaultsController.values? That is KVO compliant, but is going to be 
> quirky like all those NS…Controller objects.

Yes, it is. In the 10.12 framework, line 47:

NSUserDefaults can be observed using Key-Value Observing for any key stored in 
it.

Line 210:

NSUserDefaultsDidChangeNotification is posted whenever any user defaults 
changed within the current process, but is not posted when ubiquitous defaults 
change, or when an outside process changes defaults. Using key-value observing 
to register observers for the specific keys of interest will inform you of all 
updates, regardless of where they're from.

> — Don’t use the new and old values in the change dictionary. Use the current 
> value of the property instead. If you need to compare this to the last value 
> you saw, keep the last value as a custom property within whatever object is 
> handling the notification. (Current vs. last-seen is not the same as new vs. 
> old change value, but it’s usually what you really want anyway.)

Suggesting that the old/new values in the change dict shouldn't be used is 
kinda silly. Why waste the bandwidth sending them if they're never going to be 
used? I've used them for as long as I've been doing this Cocoa thing, and 
they've always been quite useful and correct.

I'm writing up a bug.

--
Steve Mills
Drummer, Mac geek


_______________________________________________

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