Re: objectForKey
Re: objectForKey
- Subject: Re: objectForKey
- From: Dustin Voss <email@hidden>
- Date: Fri, 15 Oct 2004 12:30:05 -0700
On 15 Oct, 2004, at 8:41 AM, Martha Espinosa wrote:
Hi,
In my project I have a dictionary with the following...
2004-10-15 09:18:17.213 Dynamic[1814] Item 1: <CFDictionary 0x341850
[0xa01900e0]>{type = mutable, count = 5, capacity = 8, pairs = (
2 : package = <CFString 0x3417d0 [0xa01900e0]>{contents =
"package"}
3 : other = <CFString 0x341800 [0xa01900e0]>{contents = "YES"}
4 : name = <CFString 0x341740 [0xa01900e0]>{contents = " name"}
6 : esdname = <CFString 0x341760 [0xa01900e0]>{contents =
"Mac"}
10 : install = <CFString 0x341700 [0xa01900e0]>{contents = "Y"}
)}
2004-10-15 09:18:17.214 Dynamic[1814] Item 2: <CFDictionary 0x341ac0
[0xa01900e0]>{type = mutable, count = 5, capacity = 8, pairs = (
2 : package = <CFString 0x341a70 [0xa01900e0]>{contents =
"package"}
3 : other = <CFString 0x341aa0 [0xa01900e0]>{contents = "YES"}
4 : name = <CFString 0x3419c0 [0xa01900e0]>{contents = " Name"}
6 : esdname = <CFString 0x341a00 [0xa01900e0]>{contents =
"Mac/"}
10 : install = <CFString 0x341980 [0xa01900e0]>{contents = "N"}
)}
How do I just grab one of the items from within this dictionary for
every item? I tried using [software objectForKey:@"install"] without
success...
int i, count;
count = [software count];
for (i = 0; i < count; i++)
{
NSString *item=[software objectAtIndex:i];
NSLog (@"Item %d: %@", i, item);
}
any help will be appreciated.
Try this:
NSArray *installs = [software valueForKey:@"install"];
If that doesn't work, and "software" is a KVC key, then try this:
NSArray *installs = [self valueForKeyPath:@"software.install"];
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
References: | |
| >objectForKey (From: Martha Espinosa <email@hidden>) |