Hi, I have a NSMutableArray of NSMutableDictionaries. How Could I update the value for a key of my array?
My array is something like this:
I would like to update a value for key "name" for example:
But Im receiving the next error:
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '*** -[NSCFDictionary setObject:forKey:]: mutating method sent to immutable object'
It is any wrong? How Can I updated it? Thanks
My array is something like this:
Code:
(
{
name = "foo";
surname = "woo";
},
{
name = "foo2";
surname = "woo2";
}
)
I would like to update a value for key "name" for example:
Code:
for (int i=0; i<[feedArray count];i++) {
NSMutableDictionary *itemAtIndex = (NSMutableDictionary *)[feedArray objectAtIndex:i];
[itemAtIndex setValue:@"David" forKey:@"name"];
[feedArray insertObject:itemAtIndex atIndex:i];
}
But Im receiving the next error:
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '*** -[NSCFDictionary setObject:forKey:]: mutating method sent to immutable object'
It is any wrong? How Can I updated it? Thanks