• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSDictionary entry with key from NSArray
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSDictionary entry with key from NSArray


  • Subject: NSDictionary entry with key from NSArray
  • From: RenĂ© Korthaus <email@hidden>
  • Date: Wed, 23 Feb 2005 12:28:14 +0100

Hey everybody,

I put some numbers in an nsarray, then I walk through that array in a while loop and try to get the objects in an nsdictionary with the keys in this nsarray like this (hope you could follow)...

<code>
NSDictionary * tracksDict = [NSDictionary dictionaryWithDictionary:[musicLibrary objectForKey:@"Tracks"]];
NSMutableArray * tmpArray = [NSMutableArray array];
int ii = 0;

while (ii < [playlistIDsArray count]) {
trackDictionary = [tracksDict objectForKey:[playlistIDsArray objectAtIndex:ii]];
NSLog(@"track: %@\n", [playlistIDsArray objectAtIndex:ii]);
[tmpArray addObject:trackDictionary];
ii++;
}
</code>

However this wont work. The Run Log keeps saying "attempt to insert nil". But when I try nslog as above, it tells me the number.

What am I missing?


Thanks, cordney*
-------------------------------------------------------------
The signature is currently on vacations.
 _______________________________________________
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

  • Follow-Ups:
    • Re: NSDictionary entry with key from NSArray
      • From: Michael Becker <email@hidden>
    • Re: NSDictionary entry with key from NSArray
      • From: Frederick Cheung <email@hidden>
  • Prev by Date: Re: Runtime problem!
  • Next by Date: Re: Runtime problem!
  • Previous by thread: Re: Cocoa equivalent of AppleScript "choose folder"
  • Next by thread: Re: NSDictionary entry with key from NSArray
  • Index(es):
    • Date
    • Thread