How to update NSMutableDictionary?

S.P. picture S.P. · Feb 9, 2010 · Viewed 26k times · Source

I have an NSMutableDictionary.

NSMutableDictionary* plistDict = [[NSMutableDictionary alloc] initWithContentsOfFile:path];

I have to update an element in that dictionary. How i can do that?

Answer

Mihir Mathuria picture Mihir Mathuria · Feb 9, 2010

Please refer to the API here

First retrieve the objects using

[dict objectForKey:@"key"];

Later, you can set them back using:

- (void)setObject:(id)anObject forKey:(id)aKey
- (void)setValue:(id)value forKey:(NSString *)key