美文网首页IOS Crash
MACatchException & -[AppMonitorT

MACatchException & -[AppMonitorT

作者: 愤斗的小蚂蚁 | 来源:发表于2019-09-28 11:09 被阅读0次

    小编毛推自荐常用基本类型MACatchException,不足之处,欢迎指正。

    image.png
    image.png

    近期升级了几家第三方SDK,新版本上线后,友盟统计出现如下错误

    -[AppMonitorTaskPool start]: attempt to start the thread again

    *** -[AppMonitorTaskPool start]: attempt to start the thread again
    (null)
    ((
        0 CoreFoundation 0x0000000213085294 <redacted> + 252
        1 libobjc.A.dylib 0x000000021225f9f8 objc_exception_throw + 56
        2 CoreFoundation 0x0000000212f8f4b0 <redacted> + 0
        3 Foundation 0x00000002139dc6ec <redacted> + 132
        4 CoreFoundation 0x0000000212ff6318 <redacted> + 20
        5 CoreFoundation 0x0000000212ff62e4 <redacted> + 64
        6 CoreFoundation 0x0000000212ff57d8 <redacted> + 392
        7 CoreFoundation 0x0000000212ff5484 <redacted> + 96
        8 CoreFoundation 0x0000000212f6ed64 <redacted> + 1496
        9 CoreFoundation 0x0000000212ff4f34 _CFXNotificationPost + 696
        10 Foundation 0x00000002139dd7f4 <redacted> + 68
        11 UIKitCore 0x000000023f83dd0c <redacted> + 1328
        12 UIKitCore 0x000000023f10c4a0 <redacted> + 472
        13 UIKitCore 0x000000023f10d188 _performActionsWithDelayForTransitionContext + 112
        14 UIKitCore 0x000000023f10c25c <redacted> + 244
        15 UIKitCore 0x000000023f110f5c <redacted> + 360
        16 UIKitCore 0x000000023f441054 <redacted> + 464
        17 FrontBoardServices 0x0000000215a015d8 <redacted> + 224
        18 libdispatch.dylib 0x0000000212ac57d4 <redacted> + 16
        19 libdispatch.dylib 0x0000000212a6a5d8 <redacted> + 224
        20 FrontBoardServices 0x0000000215a3b040 <redacted> + 40
        21 FrontBoardServices 0x0000000215a3acdc <redacted> + 408
        22 FrontBoardServices 0x0000000215a3b294 <redacted> + 52
        23 CoreFoundation 0x0000000213017018 <redacted> + 24
        24 CoreFoundation 0x0000000213016f98 <redacted> + 88
        25 CoreFoundation 0x0000000213016880 <redacted> + 176
        26 CoreFoundation 0x00000002130117bc <redacted> + 1004
        27 CoreFoundation 0x00000002130110b0 CFRunLoopRunSpecific + 436
        28 GraphicsServices 0x000000021521179c GSEventRunModal + 104
        29 UIKitCore 0x000000023f847978 UIApplicationMain + 212
        30 xxx 0x0000000104f568f0 xxx + 3303664
        31 libdyld.dylib 0x0000000212ad68e0 <redacted> + 4
    )
    dSYM UUID: 515BDE4D-BECB-39B3-98AE-41D4F096F0DC
    CPU Type: arm64
    Slide Address: 0x0000000100000000
    Binary Image: xxx
    Base Address: 0x0000000104c30000
    

    了解后没什么收获,但发现有类似错误

     *** -[NSTread start]: attempt to start the thread again
    

    经了解发现 AppMonitorTaskPool 是NSTread的子类,为了规避这个错误,自定义NSThread【分类】,通过【RunTime-方法替换】方式,重新定义了start方法。到目前为止,断点调试,仅发现下图调用堆栈中有AppMonitorTaskPool的使用


    112.png

    该方法能避免常见crash,并将crash信息发送给server,准确定位。

    重点介绍RunTime-方法替换
    常用基本类型MACatchException,不足之处,欢迎指正。

    当前工程选用了最高编译策略


    113.png

    相关文章

      网友评论

        本文标题:MACatchException & -[AppMonitorT

        本文链接:https://www.haomeiwen.com/subject/vtizuctx.html