在替换或插入NSMutable
数组时,我得到例外:
由于未捕获的异常'NSInternalInconsistencyException'而终止应用程序,原因:'*** - [NSCFArray replaceObjectAtIndex:withObject:]:发送到不可变对象的mutating方法'
[list replaceObjectAtIndex:indexRow withObject:editcontacts];
//or
[list insertObject:editcontacts atIndex:indexRow];
答案 0 :(得分:4)
您仍在使用NSArray
而不是NSMutableArray
。您需要分配list
:
NSMutableArray *list = [[NSMutableArray alloc] init];