Display each item in an NSDictionary

alanvabraham picture alanvabraham · Apr 8, 2011 · Viewed 40.6k times · Source

I am trying to display each item in NSDictionary. I have tried using a for loop but that didn't work.

Answer

PgmFreek picture PgmFreek · Apr 8, 2011

Try this code

for(NSString *key in [dict allKeys]) {
  NSLog(@"%@",[dict objectForKey:key]);
}