0

我有一个轻微的代码问题。我有一个数组,但是当我从中提取数据时,我需要以int. 为此,我尝试使用:

int main_id = [[courses valueForKey:@"id"] intValue];

但这给了我错误:

 *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason:   '-[__NSArrayI intValue]: unrecognized selector sent to instance 0x6b438d0'
*** First throw call stack:
(0x16ac022 0x183dcd6 0x16adcbd 0x1612ed0 0x1612cb2 0x4bf8 0x4fdd 0xdea1e 0xddfec 0x104f1d 0xef1cb 0x105df1 0x105e0d 0x105ea9 0x446f5 0x4473c 0x15596 0x16274 0x25183 0x25c38 0x19634 0x1596ef5 0x1680195 0x15e4ff2 0x15e38da 0x15e2d84 0x15e2c9b 0x15c65 0x17626 0x36ed 0x2695 0x1)
terminate called throwing an exception
4

1 回答 1

2

我找到了答案。我正在使用 NSArray

NSArray *array;

那里面有另一个nsarray。我试图调用 NSArray 的 intvalue。

于 2012-06-01T12:29:55.307 回答