The NSDictionary and NSMutableDictionary docs are probably your best bet. They even have some great examples on how to do various things, like... ...create an NSDictionary NSArray *keys = [NSArray arrayWithObjects:@"key1", @"key2", nil]; NSArray *objects = [NSArray arrayWithObjects:@"value1", @"value2", nil]; NSDictionary *dictionary = [NSDictionary dictionaryWithObjects:objects forKeys:keys];
…iterate over it
for (id key in dictionary) { NSLog(@"key: %@, value: %@", key, [dictionary objectForKey:key]); } NSLog(@ "%@ is %@" ,key, [dictionary objectForKey:key]);
…make it mutable
NSMutableDictionary *mutableDict = [[dictionary mutableCopy] autorelease];
…and alter it
[mutableDict setObject:@"value3" forKey:@"key3"]; ...then store it to a file [mutableDict writeToFile:@"path/to/file" atomically:YES];
…and read it back again
NSMutableDictionary *anotherDict = [NSMutableDictionary dictionaryWithContentsOfFile:@"path/to/file"];