Hi Dave,
Thanks. Your solution seems to be fine

NSArray * allKeys = [dictionary allKeys];
NSArray * allValues = [dictionary objectsForKeys:allKeys
notFoundMarker:[NSNull null]];

I also took a better look at the iTunes Music Library.xml dictionary, and
there is a fine trick.
The Tracks dictionary contains, yes, several dictionaries whose keys are
IDs.
But each track dictionary contains the same ID into its values. Like

Tracks      Dictionary          4000 items
    2604        Dictionary      32 items
        Track ID        Number  2604

This way, I can retrieve the track dictionary in a while.
And If I have the track dict only, I can always know its ID and retrieve its
position on the Tracks dictionary.
Smart.

Thanks to everybody.

--
Leo



Da: Greg Parker <gpar...@apple.com>
Data: Mon, 4 Oct 2010 14:40:31 -0700
A: "gMail.com" <mac.iphone....@gmail.com>
Cc: "cocoa-dev@lists.apple.com List" <cocoa-dev@lists.apple.com>
Oggetto: Re: allKeys and allValues

On Oct 4, 2010, at 2:31 PM, Ken Thomases wrote:
> On Oct 4, 2010, at 4:21 PM, gMail.com <http://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.

The documentation for CFDictionaryGetKeysAndValues() does promise to return
parallel arrays, so you might be able to use that instead.


-- 
Greg Parker     gpar...@apple.com     Runtime Wrangler




_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com

Reply via email to