• 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
Re: NSDictionary valueForKey: and @ character at start of NSString
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: NSDictionary valueForKey: and @ character at start of NSString
      • From: "Joe Goh" <email@hidden>
References: 
 >NSDictionary valueForKey: and @ character at start of NSString (From: "Joe Goh" <email@hidden>)

  • Prev by Date: US/non-US localization problem
  • Next by Date: [FIXED] Re: Focus ring not displaying while editing custom split NSCell
  • Previous by thread: Re: NSDictionary valueForKey: and @ character at start of NSString
  • Next by thread: Re: NSDictionary valueForKey: and @ character at start of NSString
  • Index(es):
    • Date
    • Thread