iOS闪退堆栈[UIKeyboardTaskEntry dealloc]和AutoreleasePoolPage::pop(void*)

之前版本中会有数组越界或者字典中插入nil导致闪退。上个版本就写了四个分类将系统的类objectAtIndex:objectAtIndexedSubscript:等等方法交换一下进行安全校验。结果导致闪退bug增加很多。在此记录一下方便以后查找

闪退复现步骤:

当键盘显示的情况下 home app 进入后台,再单击app 图标 切换回前台时会出现crash。拿出iOS8的测试机尝试后果然能复现。查看闪退日志从iOS8-iOS10都有闪退

1.在iOS8上闪退堆栈信息

libobjc.A.dylib objc_msgSend + 28
1 libsystem_blocks.dylib    _Block_release + 256
2 libobjc.A.dylib   (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 564
3 CoreFoundation    _CFAutoreleasePoolPop + 28
4 UIKit __wrapRunLoopWithAutoreleasePoolHandler + 76
5 CoreFoundation    ___CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
6 CoreFoundation    ___CFRunLoopDoObservers + 360
7 CoreFoundation    ___CFRunLoopRun + 836
8 CoreFoundation    CFRunLoopRunSpecific + 396
9 GraphicsServices  GSEventRunModal + 168
10 UIKit    UIApplicationMain + 1488

2.在iOS9上闪退堆栈信息

libobjc.A.dylib objc_release + 16
1 libsystem_blocks.dylib    _Block_release + 156
2 libobjc.A.dylib   (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 508
3 CoreFoundation    _CFAutoreleasePoolPop + 28
4 UIKit __prepareForCAFlush + 352
5 UIKit __afterCACommitHandler + 160
6 CoreFoundation    ___CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
7 CoreFoundation    ___CFRunLoopDoObservers + 372
8 CoreFoundation    ___CFRunLoopRun + 928
9 CoreFoundation    CFRunLoopRunSpecific + 384
10 GraphicsServices GSEventRunModal + 180
11 UIKit    UIApplicationMain + 204

3.在iOS10上闪退堆栈信息

libobjc.A.dylib objc_object::release() + 8
1 libsystem_blocks.dylib    _Block_release + 160
2 UIKit -[UIKeyboardTaskEntry dealloc] + 68
3 libobjc.A.dylib   (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 836
4 CoreFoundation    _CFAutoreleasePoolPop + 28
5 UIKit __prepareForCAFlush + 596
6 UIKit __afterCACommitHandler + 236
7 CoreFoundation    ___CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
8 CoreFoundation    ___CFRunLoopDoObservers + 372
9 CoreFoundation    ___CFRunLoopRun + 956
10 CoreFoundation   CFRunLoopRunSpecific + 424
11 GraphicsServices GSEventRunModal + 100
12 UIKit    UIApplicationMain + 208

解决方案:

通过Build Phases中 -> Compile Sources 找到了这几个 Category改成mac:-fno-objc-arc

BF816544-22AA-4ADF-992C-E77AD5172E6F.png

参考链接
1.https://shevakuilin.github.io/2018/08/14/%E4%BF%AE%E5%A4%8D%E4%B8%80%E4%B8%AA%E7%94%B1Hook%E7%B3%BB%E7%BB%9F%E7%B1%BB%E8%80%8C%E5%BC%95%E5%8F%91%E7%9A%84Crash/
2.https://juejin.im/post/5b5746356fb9a04fd4509d5b

你可能感兴趣的:(iOS闪退堆栈[UIKeyboardTaskEntry dealloc]和AutoreleasePoolPage::pop(void*))