修复报错libBacktraceRecording.dylib`__gcd_queue_item_enqueue_hook_block_invoke, queue = 'com.apple.NS...

报错信息:

libBacktraceRecording.dylib`__gcd_queue_item_enqueue_hook_block_invoke, queue = 'com.apple.NSURLSession-work', stop reason = EXC_BAD_ACCESS (code=1, address=0xf8686a68b98c6ec8)  
      * frame #0: 0x0000000100042e8c libBacktraceRecording.dylib`__gcd_queue_item_enqueue_hook_block_invoke

查阅相关文档显示,这个是苹果的一个bug,参考:苹果官方论坛、stackoverflow

After speaking with Apple Technical Support we confirmed that it's a bug within the ?libBacktraceRecording.dylib library, which is used for debugging within Xcode. I have filed a bug report and have been told that it won't crash on a users device since this is a debug error that occurs within a library not present on most users' devices.

经过多次尝试,我得出了如下结论:

只有用模拟器调试或者真机调试(USB调试/无限调试)的情况下才会出现这个崩溃,非调试模式下是没有这个崩溃的。

测试后结论得到印证,虽然这个在app上架后不会出这个问题,但是平时大部分时间都要Debug的,这样的崩溃很影响效率。

经过分析尝试,我将网络层的AFNetworking网络请求改为Moya,再次编译,问题解决了。

可能是因为AFNetworking网络请求的某个阶段与libBacktraceRecording.dylib冲突了,导致崩溃。

你可能感兴趣的:(修复报错libBacktraceRecording.dylib`__gcd_queue_item_enqueue_hook_block_invoke, queue = 'com.apple.NS...)