NSZombieEnabled does not work

前端 未结 8 1803
谎友^
谎友^ 2020-12-15 07:59

When I set NSZombieEnabled = Yes nothing is written to the console. How can I fix this? Or can you advise me any other tools for an EXC_BAD_ACCESS?

8条回答
  •  忘掉有多难
    2020-12-15 08:21

    "EXC_BAD_ACCESS" is not necessarily related to a zombie instance. It can be linked an access to an undefined reference, like a local variable.

    NSArray *array;
    [array objectAtIndex:0]; // <- Will throw an error
    

    Edit: NSZombie flag will only help you to solve the "EXC_BAD_ACCESS" triggered by the use of a de-allocated instance.

    In order to solve the bugs, you have to use the crash backtrace to pinpoint the location that is wrong. Then, go backward into your code and check every assignment and allocations.

提交回复
热议问题