Re: NSDictionary setValue KVO
Re: NSDictionary setValue KVO
- Subject: Re: NSDictionary setValue KVO
- From: Ken Thomases <email@hidden>
- Date: Sun, 10 Oct 2010 15:49:42 -0500
On Oct 10, 2010, at 3:19 PM, Kyle Sluder wrote:
> On Sun, Oct 10, 2010 at 12:57 PM, Ken Thomases <email@hidden> wrote:
>> A quick test program on Snow Leopard: a) confirms that NSMutableDictionary sends out change notifications for its keys, but b) does not send out change notifications for the allValues property.
>
> A quick test program also confirms that either I stink at writing
> quick test programs or NSDictionary does not send out old/new values
> in the change dictionary.
>
> http://gist.github.com/619529
Hate to tell you, but you stink at writing quick test programs. ;P
Your invocation of -addObserver:... specified 0 for the options. You have to specify NSKeyValueObservingOptionNew to get the new value and/or NSKeyValueObservingOptionOld to get the old value. I modified your test program to specify both and got:
2010-10-10 15:48:39.970 Untitled2[47695:903] root.key1 changed string1 -> differentString
Cheers,
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