Crash on __pthread_kill [closed]

2020-05-23 13:34发布

问题:

Got the crash report below, but have no clue why it would be happening and how to fix it.

SIGABRT ABORT at 0x000000019aa3258c

libsystem_kernel.dylib __pthread_kill

Thread : Crashed: com.apple.main-thread
0  libsystem_kernel.dylib         0x000000019aa3258c __pthread_kill + 8
1  libsystem_pthread.dylib        0x000000019aab516c pthread_kill + 104
2  libsystem_c.dylib              0x000000019a9c6808 abort + 112
3  libc++abi.dylib                0x0000000199bec994 __cxa_bad_cast
4  libc++abi.dylib                0x0000000199c07184 std::__terminate(void (*)()) + 44
5  libc++abi.dylib                0x0000000199c06d3c __cxa_rethrow + 144
6  libobjc.A.dylib                0x000000019a3443a8 objc_exception_rethrow + 44
7  CoreFoundation                 0x000000018dd3d74c CFRunLoopRunSpecific + 576
8  GraphicsServices               0x0000000193a21c0c GSEventRunModal + 168
9  UIKit                          0x0000000190e6efdc UIApplicationMain + 1156
10 *************                  0x00000001000a5c80 main (main.m:17)
11 libdyld.dylib                  0x000000019a937aa0 start + 4

回答1:

To make it easier to see where the crash is originating, change your main.m file as follows:

int main(int argc, char* argv[])
{
    @autoreleasepool
    {
        int returnValue;
        @try
        {
            returnValue = UIApplicationMain(argc, argv, nil, 
                NSStringFromClass([MyAppDelegate class]));
        }
        @catch (NSException* exception)
        {
            LogError(@"Uncaught exception: %@, %@", [exception description], 
                [exception callStackSymbols]);
            @throw exception;
        }
        return returnValue;
    }
}

. . . or as others have suggested, set an exception breakpoint.

If your crash is only happening "in the wild" you'll have to resymbolicate your crash logs. Services like Hockey or Test Flight do this for you, or it can be done manually following this process.