views:

912

answers:

1

I have an NSMutableDictionary.

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

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

+1  A: 

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
Mihir Mathuria
thanks. i tried like this. it worked..[plistDict removeObjectForKey:@"name"] ;[plistDict setObject:@"my name" forKey:@"name"];
Sijo
You don't need to remove the object for a key before setting the new value.
rpetrich
i need only [plistDict setObject:@"my name" forKey:@"name"]; ? ok. i will try this .Thanks.
Sijo