內存錯誤crash現場:
Thread堆棧:
有可能是訪問被釋放對象造成,根據現場並不能找到具體哪個對象出現內存錯誤。
1.開啟僵屍對象調試
Edit Scheme->Debug->Diagnostics->Enable Zombie Objects
2.閃退後查看控制台,看輸出應該是某個Button出錯
2016-10-14 16:40:49.959 funmiosbr_ZQB[2761:388881] *** -[UIButton setHidden:]: message sent to deallocated instance 0x185942a0
3.由於新版xcode默認調試器為lldb,舊版本gdb調試器可以使用如下命令查看
(gdb) info malloc-history 0x185942a0
(1)Profile your project
(2)Select Zombies from the list of instruments
(3)Make your app trigger the problem
(4)At this point you should be presented with the address that was already deallocated and you can explore it.
(5)定位問題