解决iOS出错libc++abi.dylib handler threw exception

解决iOS报错libc++abi.dylib handler threw exception

在iOS开发时,有时候遇到libc++abi.dylib handler threw exception这样的异常,  虽然在断点出加上了All Exceptions,也断到相应的代码了,但是没打印对应的日志,实际上不是这段代码的问题。因此不知道什么地方出错了。这时候可以用下面的代码来打印异常log

@try{
 
    }
    @catch(NSException *exception) {
        NSLog(@"exception:%@", exception);
    }
    @finally {
        
    }

 我在项目中使用了一下,打印出这样的日志来。

Supported orientations has no common orientation with the application, and shouldAutorotate is returning YES

 因为子类需要横屏,父类没设置横屏,所以爆出异常来。这样修改相应的代码就解决了。