我已经坐了一个小时了,因为一些奇怪的异常。 我尝试调用一些方法:
for (int i = 0; i < [[DBElements objectAtIndex:index] count]; i++) {
NSLog(@"selected Element: %@", [[DBElements objectAtIndex:index] objectAtIndex:i]);
[self addElementsToView:dash withString:[[DBElements objectAtIndex:index] objectAtIndex:i] index:index andSubindex:i];
}
该方法属于以下类型:- (void) addElementsToView: (UIView *) dash withString: (NSString *) type index:(NSInteger)index andSubindex : (int) i {}
NSLog
显示:
selected Element: NUMBER so the index stuff is ok. Why I get on the next step the following exception:
[__NSArrayI intValue]: unrecognized selector sent to instance 0x14d44f70 * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayI intValue]: unrecognized selector sent to instance 0x14d44f70'
更新:DBElements 是:
( ( NUMBER, LABEL ), LABEL )
索引为0 i 是 0。所以它显示为 NSString 类型的 NUMBERS。
最佳答案
尝试转换
withString:[[DBElements objectAtIndex:index] objectAtIndex:i]
像这样:
withString:(NSString *)[[DBElements objectAtIndex:index] objectAtIndex:i]
希望对您有所帮助!
关于ios - NSArray : 'NSInvalidArgumentException' 上无法识别的选择器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24527351/