xcode4调试报错exc_bad_access

本文介绍如何使用Xcode和Instruments工具中的Zombies功能来定位和解决EXC_BAD_ACCESS错误,这是一种常见的内存访问错误,通常由过早释放对象引起。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

EXC_BAD_ACCESS is not an exception, at least not as far as breakpoints are concerned - it means the code is trying to call a method on an object that does not exist anymore, because you released it.

The easiest way to find this in XCode4 is to run Instruments (Cmd-I), and in the dialog that pops up asking you which instrument to use, choose "Zombies". Then do whatever to cause the crash, and you will see a dialog pop up with "Zombie Messaged". Click on the little arrow and you will get a history of what created, retained, or released the object. Then you can figure out who released the object early.

To edit environment variables, go to Menu Product / Edit Scheme…, select the desired configuration (you probably want 'Run') from the left sidebar first and then click on the Arguments tab. Environment variables are configurable there.

错误原因为提前release。找不到引用。可以设置调式工具来查看哪里报错:选择 menu-》product-》edit scheme 

在左边导航选择run。。选项,右边点击arguments 标签。在environment variables中配置

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值