在Xcode4中找到EXC_BAD_ACCESS的原因- [英] finding reason for EXC_BAD_ACCESS - in Xcode4

查看:80
本文介绍了在Xcode4中找到EXC_BAD_ACCESS的原因-的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在与根本原因无关的地方收到了EXC_BAD_ACCESS错误.幸运的是,我发现原因是对于以下语句[data getBytes:&tcpBuffer length:i];而言,该数组太小了.

I get an EXC_BAD_ACCESS error at a place that doesn't have anything to do with the root cause. I fortunately found the reason to be an array that was too small for the following statement [data getBytes:&tcpBuffer length:i];.

现在我的问题是:我尝试了所有这三种方法-但没有成功:

Now my question: I tried all these theree methods - but without success:

  1. 使用NSZombiesEnabled不会更改调试窗口打印输出中的任何内容
  2. 当我将方案设置为调试并使用泄漏仪器时,它会启动泄漏仪器,但看不到调试器.
  3. 当我分别在iPhone Simulator和启动Instruments中分别运行该应用程序时,选择正在运行的应用程序作为目标(在Instruments的弹出菜单中),它停止并显示一条错误,提示找不到该目标.

在这种情况下,如何找到根本原因?请记住,最后,这甚至不是Zombie错误!此错误消息确实比帮助更令人困惑!

How does one find the root cause in cases like that? Keep in mind, at the end, it wasn't even a Zombie error! This error message is REALLY more confusing than helpful!

(幸运的是,我刚刚想到了我的阵列,但是可以肯定的是,下次它会困扰我其他地方)

(luckily I just thought of my array, but surely, the next time this will haunt me somewhere else)

推荐答案

获得EXC_BAD_ACCESS的位置很可能与根本原因无关.它可能是相关的,因此可以提供一个线索.但这还不确定.

It's quite likely that the place you get the EXC_BAD_ACCESS will not be related to the root cause. It could be related and could therefore offer a clue. But that's not certain.

回答您的观点:

  1. NSZombiesEnabled仅在您对已释放的对象调用方法时才有效.这可能不是您EXC_BAD_ACCESS的原因.

  1. NSZombiesEnabled will only have an effect if you invoke a method on an object that has been deallocated. That might not be the cause of your EXC_BAD_ACCESS.

使用仪器与调试器分开.如果您在Instruments中进行配置文件,则调试器将处于非活动状态.基本上,这是一种不同的工具.

Using Instruments is separate to the debugger. If you profile in Instruments, the debugger is not active. Basically, it's a different tool.

应该没问题.检查您的构建配置是否设置为调试"而不是发布".

This should be ok. Check that your Build Configuration is set to "Debug" and not "Release".

有关导致EXC_BAD_ACCESS的原因以及如何找出根本问题的链接,这是一个很好的链接:

Here's a great link on what causes EXC_BAD_ACCESS and how to track down the root problem:

Lou Franco对EXC_BAD_ACCESS的理解

这篇关于在Xcode4中找到EXC_BAD_ACCESS的原因-的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆