Re: <null> value in KVO change dictionary ?
Re: <null> value in KVO change dictionary ?
- Subject: Re: <null> value in KVO change dictionary ?
- From: Ken Thomases <email@hidden>
- Date: Fri, 22 Aug 2014 21:36:51 -0500
On Aug 22, 2014, at 4:31 PM, Luc Van Bogaert <email@hidden> wrote:
> I'm puzzled by a problem that I am seeing with key value observing an arraycontroller and I'm hoping that someone here could shed some light.
> I've tried observing other arraycontroller properties, such as 'selectionIndexes' or 'selectedObjects', and the document gets all the notifications, but 'new' as well as 'old' value in the change dictionary are always 'null', even though I can get a hold of the selected object using '[object selectedObjects]'. So why is this object not in the change dictionary?
This is a long-standing issue with array controllers. The KVO change notifications never include the new or old values, regardless of the KVO options to request them. You just have to query the object via the key path to get the new value. If you request NSKeyValueObservingOptionPrior, you can get the old value at the time that fires.
Regards,
Ken
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden