On Nov 12, 2009, at 6:52 AM, Jeremy Pereira <a...@jeremyp.net> wrote:
On 12 Nov 2009, at 14:23, Hank Heijink (Mailinglists) wrote:
Why is that? The only difference between setValue:forKey: and
setObject:forKey: is that the former uses the latter unless value
is nil, in which case the key will be removed. Come to think of it,
using setObject:forKey: will give me the advantage of raising an
exception if I try to add nil to the dictionary instead of failing
silently - I think I'll switch. Thanks!
That shows that one should check the docs before saying something.
I always thought setValue:forKey: was only for use with key-value
coding but the docs for NSMutableDictionary seem to imply you can
also use it in the more general way as you are doing.
While -setValue:forKey: will work, you are correct in saying that you
should only use it for key-value coding. KVC keys must be strings,
NSMutableDictionary will prefer to respond to it's own properties
before checking its contents, nil is handled differently…
--Kyle Sluder_______________________________________________
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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to arch...@mail-archive.com