Ok, I will not rely on that.
Anyway, I have seen that iTunes uses the same dictionary structure.
The file "iTunes Music Library.xml" contains a dictionary called Tracks.
This dict contains a series of dictionaries with an ID as key. So it's very
easy to get a track's dict asking for e.g.
    [tracks objectForKey:@"2604"];

Instead using an array of dicts, in case I have to search for an item by its
ID, I must iterate through the whole array looking for that ID, e.g.
    for(id item in items){
        NSString *ID = [item objectForKey:@"ID];
        if([ID isEqualToString:@"inID"])
            return item;
    }

--
Leo


> Da: Ken Thomases <[email protected]>
> Data: Mon, 4 Oct 2010 16:31:17 -0500
> A: "gMail.com" <[email protected]>
> Cc: <[email protected]>
> Oggetto: Re: allKeys and allValues
> 
> On Oct 4, 2010, at 4:21 PM, gMail.com wrote:
> 
>> On the docs I read that for both the NSDictionary's allKeys and allValues,
>> the order of the elements in the array is not defined. Ok.
>> But, are the two arrays aligned each other?
> 
> If the docs don't contain that promise, then you can't rely on it.
> 
> Regards,
> Ken
> 


_______________________________________________

Cocoa-dev mailing list ([email protected])

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to