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

查看:24
本文介绍了在 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 的弹出菜单中)它会停止并显示错误,例如找不到目标.

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

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天全站免登陆