您的位置:首页 > 移动开发 > IOS开发

iOS 内存错误调试(EXC_BAD_ACCESS)

2016-10-14 17:02 295 查看
内存错误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)定位问题

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: