• 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: email@hidden
  • Date: Tue, 15 May 2007 11:50:46 -0400


On May 15, 2007, at 10:45 AM, Joe Goh wrote:

Does anyone *know* why Apple has decided to add the extra functionality to NSDictionary to handle strings with @ characters at the start seperately? Is it for some internal Cocoa use or some remnant from NeXT? Is my category method safe for production use?

You should really read the entire documentation on Key-Value Coding. As Clark noted, your category on NSDictionary breaks all of the set operators (they all begin with "@" ).


http://developer.apple.com/documentation/Cocoa/Conceptual/KeyValueCoding/index.html

I suggest you re-think your data model and not use arbitrary strings as a key. In addition to the problem you have now with the @, if you get a key that has a period in it, it will cause problems for any calls to the AtKeyPath: methods. You may not see a need for them now, but KVC is used throughout the frameworks, so you are limiting future flexibility in accessing your data.

----
Aaron Burghardt
email@hidden

_______________________________________________

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


References: 
 >NSDictionary valueForKey: and @ character at start of NSString (From: "Joe Goh" <email@hidden>)
 >Re: NSDictionary valueForKey: and @ character at start of NSString (From: Sam Stigler <email@hidden>)
 >Re: NSDictionary valueForKey: and @ character at start of NSString (From: "Joe Goh" <email@hidden>)
 >Re: NSDictionary valueForKey: and @ character at start of NSString (From: Buddy Kurz <email@hidden>)
 >Re: NSDictionary valueForKey: and @ character at start of NSString (From: "Joe Goh" <email@hidden>)
 >Re: NSDictionary valueForKey: and @ character at start of NSString (From: "Joe Goh" <email@hidden>)

  • Prev by Date: Re: Out-of-bounds error when removing entry from NSForm
  • Next by Date: nsarraycontroller outlets
  • 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