You can get an NSArray containing the keys of an object using the allKeys method. Then you can examine it by index. Note that the order in which keys are displayed in the array is unknown. Example:
NSMutableDictionary *dict; NSArray *keys = [dict allKeys]; id aKey = [keys objectAtIndex:0]; id anObject = [dict objectForKey:aKey];
EDIT: Actually, if I understand what you're trying to do what you want, it's easy to do with a quick enumeration, like this:
NSMutableDictionary *dict; for (id key in dict) { id anObject = [dict objectForKey:key]; }
EDIT: Fixed typo marked by Marco.
Benno Sep 25 '09 at 6:30 2009-09-25 06:30
source share