• 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: "." in key path / NSKeyValueCoding
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "." in key path / NSKeyValueCoding


  • Subject: Re: "." in key path / NSKeyValueCoding
  • From: Michael Gersten <email@hidden>
  • Date: Thu, 27 Jun 2002 10:47:05 -0700

One idea is to not use the key paths, but walk the individual keys.

result = [[ myObject valueForKey: @"some.string"] valueForKey: @"secondKey"];

Not tested, but tell me if it works.

Yes, the key/value path coding API has a flaw -- there's no way for an object to say what part of the path is the key that it works with. There's special case coding for "@"'s, "."'s, and no way to add a new special case or change the assumptions of the existing special cases.

Aaron Tuller wrote:
>
> I'm using NSKeyValueCoding and in certain circumstances a key has a
> period in it so when I do valueForKeyPath: it gets really confused.
> for example if myKey is "some.string" and my next key is "secondKey"
> it read the path as "some.string.secondKey" having three elements.
>
> is there anyway to escape the period in the first key? I tried a
> slash and that did nothing. or maybe simply the answer is make sure
> there are no periods in your key path except to separate out keys.
>
> thanks.
>
> -aaron
> _______________________________________________
> cocoa-dev mailing list | email@hidden
> Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
> Do not post admin requests to the list. They will be ignored.

--
I am a Mac 10-Cocoa/WOF/EOF developer, and I'm available for hire. Please contact me at michael-job @ stb.nccom.com if interested. Resume at http://resumes.dice.com/keybounce
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >"." in key path / NSKeyValueCoding (From: Aaron Tuller <email@hidden>)

  • Prev by Date: Re: Protecting Software w/ Software License -- a modest
  • Next by Date: OT: Categories and alloc.
  • Previous by thread: "." in key path / NSKeyValueCoding
  • Next by thread: Newbie probably not retaining himself to well...
  • Index(es):
    • Date
    • Thread