FROM : Dustin Voss
DATE : Fri Oct 15 21:30:05 2004
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"];
DATE : Fri Oct 15 21:30:05 2004
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"];
| Related mails | Author | Date |
|---|---|---|
| Martha Espinosa | Oct 15, 17:41 | |
| stephane sudre | Oct 15, 17:47 | |
| Dustin Voss | Oct 15, 21:30 | |
| Scott Stevenson | Oct 16, 01:15 |






Cocoa mail archive

