• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSDictionary valueForKey: and @ character at start of NSString
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSDictionary valueForKey: and @ character at start of NSString


  • Subject: NSDictionary valueForKey: and @ character at start of NSString
  • From: "Joe Goh" <email@hidden>
  • Date: Tue, 15 May 2007 12:48:41 +0800

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?

Thanks!
Joe Goh
FunkeeMonk Technology
http://www.funkeemonk.com/
_______________________________________________

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


  • Follow-Ups:
    • Re: NSDictionary valueForKey: and @ character at start of NSString
      • From: "Shawn Erickson" <email@hidden>
    • Re: NSDictionary valueForKey: and @ character at start of NSString
      • From: Sam Stigler <email@hidden>
  • Prev by Date: Re: paths for contents of a directory
  • Next by Date: Re: paths for contents of a directory
  • Previous by thread: Re: paths for contents of a directory
  • Next by thread: Re: NSDictionary valueForKey: and @ character at start of NSString
  • Index(es):
    • Date
    • Thread