我有一个 NSArray(RSIatAddr),我想检查给定索引处的对象是否 = 0(或其他任意常量),但以下代码没有给我任何警告/错误;但抛出异常
if ([[RSIatAddr objectAtIndex:j] isEqualToNumber:nil]) {
[sumRSI addObject:[NSNumber numberWithInt:[[RSIatAddr objectAtIndex:j]intValue]*
[[sumRSI objectAtIndex:j] intValue]]]; }
我得到的错误:
2012-10-02 00:42:00.266 NetSearch+DetectLocation[3741:707]
*** Terminating app due to uncaught exception
'NSInvalidArgumentException', reason: '-[__NSCFNumber compare:]: nil argument'