Exception Types in iOS crash logs

前端 未结 4 975
忘掉有多难
忘掉有多难 2020-12-02 04:51

I\'ve seen a few different types of crash logs since I begin learning iOS development.

I know that: Exception Type: EXC_BAD_ACCESS (SIGSEGV) mea

4条回答
  •  难免孤独
    2020-12-02 05:13

    I know that: Exception Type: EXC_BAD_ACCESS (SIGSEGV) mean we are accessing a released object.

    No.

    A SIGSEGV is a segmentation fault, meaning you are trying to access an invalid memory address.

    Those exceptions (in fact, they are signals) are not related to Objective-C, but C. So you can get such an exception without Objective-C objects.

    Note that a signal is not an exception, meaning you can't catch them with @try and @catch blocks.

    You may set a signal handler with the signal and sigaction functions. Keep in mind some signals, like SIGABRT cannot be blocked.

    You can check the Wikipedia page about signals, if you want more informations.

    That said, to resume:

    SIGSEGV (Segmentation fault)

    Access to an invalid memory address. The address exist, but your program does not have access to it.

    SIGBUS (Bus error)

    Access to an invalid memory address. The address does not exist, or the alignment is invalid.

    SIGFPE (Floating point exception)

    Invalid arithmetic operation. Can be related to integer operations, despite the name.

    SIGPIPE

    Broken pipe.

    SIGILL

    Illegal processor instruction.

    SIGTRAP

    Debugger related

    SIGABRT

    Program crash, not related to one of the preceding signal.

提交回复
热议问题