View Full Version : Array of NSDictionaries

Oct 2, 2009, 05:49 PM
so I have an NSArray of NSDictionaries, and I would like to return an NSArray of keys from these dictionaries.

where do I start?

Oct 2, 2009, 05:55 PM
Do all of the dictionaries have the same keys? If so, just get the first element of the NSArray, and get the keys of the NSDictionary using allKeys. If not, for each array element get the keys and append them to an NSMutableArray with addObjectsFromArray.


Oct 2, 2009, 05:55 PM
NSDictionary has a method allKeys: and then you can combine the arrays using NSMutableArray's addObjectsFromArray:

Oct 2, 2009, 05:56 PM
All the dictionaries do have the same keys