estupefactika
Jul 1, 2009, 10:49 AM
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:
(
{
name = "foo";
surname = "woo";
},
{
name = "foo2";
surname = "woo2";
}
)
I would like to update a value for key "name" for example:
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
My array is something like this:
(
{
name = "foo";
surname = "woo";
},
{
name = "foo2";
surname = "woo2";
}
)
I would like to update a value for key "name" for example:
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
