Re: "." in key path / NSKeyValueCoding
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.