if (commentArray==nil)
{
commentArray = [[NSMutableArray alloc] init];
}
commentArray = (NSMutableArray*)[responseObject objectForKey:@"comment”];
*** Terminating app due to uncaught exception ‘NSInternalInconsistencyException‘, reason: ‘-[__NSCFArray insertObject:atIndex:]: mutating method sent to immutable object‘
*** First throw call stack:
一个不可变的数组调用了可变数组中的方法(添加/删除等)
if
(commentArray==nil)
{
commentArray = [[NSMutableArray
alloc]
init];
}
NSArray *array = [responseObject
objectForKey:@"comment"];
for (int
i=0; i<array.count;
i++) {
NSDictionary *dic = [array
objectAtIndex:i];
[commentArray
addObject:dic];
}
[commentArray
addObject:@"nihao"];
mutating method sent to immutable object
原文:http://blog.csdn.net/u010241322/article/details/44596083