我的代码是:
[[arrayOne objectAtIndex:indexSelected] replaceObjectAtIndex:1 withObject:new];
NSLog(@"indexSelected:%d", indexSelected); // = 0
NSLog(@"new:%@", new); // = 26
indexSelected
是一个整数,new
是一个字符串。
当我尝试这样做时,会出现一个异常,显示:Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayI replaceObjectAtIndex:withObject:]: unrecognized selector sent to instance 0x1cee60'
为什么会出现这种情况?