Re: NSDictionary valueForKey: and @ character at start of NSString
Re: NSDictionary valueForKey: and @ character at start of NSString
- Subject: Re: NSDictionary valueForKey: and @ character at start of NSString
- From: "Shawn Erickson" <email@hidden>
- Date: Tue, 15 May 2007 09:26:19 -0700
On 5/14/07, Joe Goh <email@hidden> wrote:
Hi everyone,
According to the NSDictionary docs for valueForKey: , it says,
"If key does not start with "@", invokes objectForKey:.
If key does start with "@", strips the "@" and invokes [super
valueForKey:] with the rest of the key."
For my app, I need to handle NSString's (sent by the user) with the @
character at its start.
To work around this issue, i've implemented a category on NSDictionary
that simply calls objectForKey: when valueForKey: is invoked.
Is this dangerous? Will I break anything used by Cocoa internally if
I do this? What's the rationale behind this behaviour for
valueForKey: in the first place?
Stepping back from this... why not just call objectForKey: directly?
Why are you attempting to use valueForKey: in a way other then it was
really intended?
-Shawn
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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