Eternal21
Eternal21

Reputation: 4674

Is it possible to catch 3rd party iOS library exception?

My Objective-C application is using a 3rd party VoIP SDK. I found the application crashes if left running overnight. The crash only happens if I enable the SDK, so I strongly suspect it causes the crash.

The library is a static library (.a extension). I tried catching the exception using try-catch block, and NSSetUncaughtExceptionHandler, but it didn't work. I suspect those methods only work with Objective-C exceptions, and the SDK is written in native C?

Is it possible to catch a 3rd party native C exception? I'm fine with any kind of hacks, since this will not be going into production code. Just trying to get to the bottom of the issue.

EDIT: Here's the crash log:

    Hardware Model:      iPad5,1
    Version:             0.14 (6.0)
    Beta:                YES
    Code Type:           ARM-64 (Native)
    Role:                Foreground
    Parent Process:      launchd [1]


    Date/Time:           2016-11-22 08:24:59.7336 -0500
    Launch Time:         2016-11-21 13:45:09.9956 -0500
    OS Version:          iPhone OS 10.1.1 (14B100)
    Report Version:      104

    Exception Type:  EXC_CRASH (SIGABRT)
    Exception Codes: 0x0000000000000000, 0x0000000000000000
    Exception Note:  EXC_CORPSE_NOTIFY
    Triggered by Thread:  0

    Application Specific Information:
    abort() called

    Filtered syslog:
    None found

    Last Exception Backtrace:
    (0x18953e1c0 0x187f7855c 0x18953e108 0x18f89359c 0x18f6f4444 0x18f4c653c
 0x18f391d48 0x18f391c78 0x18f44bb10 0x18f44aec0 0x18f44a90c 0x18f44a4c0
 0x18f44a424 0x18f38f220 0x18c84f188 0x18c843e64 0x18c843d24 0x18c7c07ec 
0x18c7e7c58 0x18c7e8678 0x1894eb7dc 0x1894e940c 0x1894e989c 0x189418048 
0x18ae9e198 0x18f3fd2fc 0x18f3f8034 0x10002304c 0x1883fc5b8)

    Thread 0 name:  Dispatch queue: com.apple.main-thread
    Thread 0 Crashed:
    0   libsystem_kernel.dylib          0x000000018850e014 0x1884ef000 + 126996
    1   libsystem_pthread.dylib         0x00000001885d6450 0x1885d1000 + 21584
    2   libsystem_c.dylib               0x00000001884823e0 0x18841f000 + 406496
    3   libc++abi.dylib                 0x0000000187f4d2d4 0x187f4c000 + 4820
    4   libc++abi.dylib                 0x0000000187f6acc0 0x187f4c000 + 126144
    5   libobjc.A.dylib                 0x0000000187f78844 0x187f70000 + 34884
    6   libc++abi.dylib                 0x0000000187f6766c 0x187f4c000 + 112236
    7   libc++abi.dylib                 0x0000000187f67234 0x187f4c000 + 111156
    8   libobjc.A.dylib                 0x0000000187f7871c 0x187f70000 + 34588
    9   CoreFoundation                  0x00000001894180bc 0x18940f000 + 37052
    10  GraphicsServices                0x000000018ae9e198 0x18ae92000 + 49560
    11  UIKit                           0x000000018f3fd2fc 0x18f382000 + 504572
    12  UIKit                           0x000000018f3f8034 0x18f382000 + 483380
    13  Remote                          0x000000010002304c 0x100008000 + 110668
    14  libdyld.dylib                   0x00000001883fc5b8 0x1883f8000 + 17848

Upvotes: 1

Views: 364

Answers (1)

bbum
bbum

Reputation: 162712

That isn't a catchable exception, that is a hard crash. And, specifically, it is a purposeful crash; something on the main thread decided things had gone badly enough that it called abort().

So, no, nothing you can do to catch it and it isn't even clear that the crash is triggered by the 3rd party library, given that crash log.

Upvotes: 4

Related Questions