当 ind.row 不是有效值或有时它变为 nil 时,我正在使用以下代码来捕获错误
@try {
if(ind.row<[[treeNode flattenElements] count])
{
[self.mTableView scrollToRowAtIndexPath:ind atScrollPosition:UITableViewScrollPositionTop animated:YES];
}
}
@catch (NSException *e) {
NSLog(@"%@",e);
}
但是当这段代码执行时,有时会发生这个错误
Assertion failure in -[NSIndexPath row], /SourceCache/UIKit_Sim/UIKit-1262.60.3/UITableViewSupport.m:1948`
这个错误的原因可能是什么以及为什么没有处理异常