0
我有這樣的數組輸出。從iphone陣列中的陣列值的替換
{
id = 1;
user = {
name="ABC"
}
},
{
id = 2;
user = {
name="XYZ"
}
},
我不得不改變與5號和6名ID爲 「ASD」 和 「FGH」。我的數組定義在這裏。
myArray=[[NSMutableArray alloc]initWithArray:statuses];
這裏是我對「id」進行chaning的方法。
[[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'
請檢查我只是編輯。 – user851954
嘗試改爲:myArray = [狀態mutableCopy]; – Daniel
我改變了,但仍然是同樣的問題。 – user851954