Re: allKeys and allValues
Re: allKeys and allValues
- Subject: Re: allKeys and allValues
- From: "gMail.com" <email@hidden>
- Date: Tue, 05 Oct 2010 10:13:23 +0200
- Thread-topic: allKeys and allValues
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 <email@hidden>
Data: Mon, 4 Oct 2010 14:40:31 -0700
A: "gMail.com" <email@hidden>
Cc: "email@hidden List" <email@hidden>
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 email@hidden Runtime Wrangler
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden