Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

vikasA

macrumors newbie
Original poster
Mar 7, 2011
4
0
I want to access the value for each key in this dictionary

{ "key1": "val1", "key2" : "val2", "key3" : "val3", "key4" : [{ "key41": "val41", "key42" : "value42" } ,{ "key41": "val41", "key42" : "value42" } ]}

//for val1
NSString *str = [[self.data objectForKey:Key1] objectAtIndex:1];

//for val41
NSString *str = [[[self.data objectForKey:Key4] objectForKey:1] objectAtIndex:row];


But the app is crashing.

any suggestion??
 
Key4 looks like it should be giving you back an array, so you shouldn't be sending it objectForKey: messages, but objectAtIndex: messages instead.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.