【发布时间】:2011-07-19 12:32:34
【问题描述】:
我有这样的数组输出。
{
id = 1;
user = {
name="ABC"
}
},
{
id = 2;
user = {
name="XYZ"
}
},
我必须将 id 更改为 5 和 6,并将名称更改为“asd”和“fgh”。我的数组定义在这里。
myArray=[[NSMutableArray alloc]initWithArray:statuses];
这是我改变“id”的方法。
[[myArray objectAtIndex:0]replaceObjectAtIndex:0 withObject:@"5"];
[[myArray objectAtIndex:0]replaceObjectAtIndex:0 withObject:@"6"];
但我得到了以下接受。
[__NSCFDictionary replaceObjectAtIndex:withObject:]: unrecognized selector sent to instance 0x6511810
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFDictionary replaceObjectAtIndex:withObject:]: unrecognized selector sent to instance 0x6511810'
【问题讨论】: