How to debug EXC_BAD_ACCESS bug

前端 未结 3 1605
孤城傲影
孤城傲影 2020-12-14 01:17

I received an error

EXC_BAD_ACCESS code=2 at0xb0987654

I am wondering how to print out the value at 0xb0987654?

3条回答
  •  北荒
    北荒 (楼主)
    2020-12-14 01:39

    Identify what you did that caused the crash. Did it crash while view of a particular view controller didLoad or in a delegate method or on a particular action. That will often help to find the object that is casuing the error.

    • Most of the time “NSZombies” can help to identify the dead object. You can enable NSZombies by editing your scheme Product -> Edit Scheme -> Diagnostics.
    • If you still don’t find the root cause then always go backwards from child view controller to parent view controller to see what object needs to be retained or what message needs to be passed properly.
    • Look into Static Analyzer and Instruments for advanced debugging.

    I hope this will help you.

    Regards, Gison

提交回复
热议问题