文章出处:http://blog.csdn.net/totogo2010/article/details/9816975
在iOS开发时,有时候遇到libc++abi.dylib handler threw exception这样的异常, 虽然在断点出加上了All Exceptions,也断到相应的代码了,但是没打印对应的日志,实际上不是这段代码的问题。因此不知道什么地方出错了。这时候可以用下面的代码来打印异常log
@try{
}
@catch(NSException *exception) {
NSLog(@"exception:%@", exception);
}
@finally {
}
以下为我断点调试停住抛异常的代码
@try{
[superMasketCell setSuperMasketCellBean:recommendArray[indexPath.row]];//异常代码
}
@catch(NSException *exception) {
NSLog(@"exception:%@", exception);
}
@finally {
}
如上图,我开始一直找不到错误的地方,经过打印之后,我知道是数组越界了,搞定。