本文介绍了iOS EXC_BAD_ACCESS:如何调试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在获得一个EXC_BAD_ACCESS。我知道这通常是什么意思:尝试访问不存在的对象(不再)是最有可能的原因。



那么,我在哪里可以找到? / p>

我已经看过互联网上的大量帖子,他们都说:



启用NSZombie 。



现在,当我运行调试器,我该怎么看?我看不到任何差异...



注意:这不是关于我的代码中的perticular错误,而是通常如何使用启用NSZombie的调试器

解决方案

我会做的是在绿色箭头上方找到一个断点,显示EXC_BAD_ACCESS错误。然后再次运行您的代码并重现步骤来生成崩溃。



当您进入断点时,您可以使用右键单击和打印描述来检查对象是否为有效对象在Xcode的控制台左侧,或在XCode的控制台部分输入命令'po'。这就是我通常检测错误的方式。



有用的是在调试器停止后跟踪堆栈。它在左侧面板中显示了断点之前的方法的线索和链接。



希望这有助于我,并希望我对如何跟踪的方法的描述错误有帮助。


I am getting an EXC_BAD_ACCESS. I know what this usually means: Trying to access an object that doesn't exist (anymore) is the most likely cause.

So, where do I find that?

I have read numerous posts on the internet, and they all say:

"Enable NSZombie" in the scheme.

Now when I run the debugger, for what should I look? I can not see any difference...

Note: This is not about a perticular error in my code, but generally how to use the debugger with NSZombie enabled

解决方案

What I would do it will be to locate a breakpoint just one line above the green arrow showing the EXC_BAD_ACCESS error. Then run again your code and reproduce the steps to generate the crash.

When you get to your breakpoint you can check that your objects are valid objects using right click and print description in the left side of your console within Xcode or typing the command 'po' within the console section in XCode. That's how I usually detect the errors.

Something useful is to trace the stack once the debugger stopped. It show in the left panel the threads and chain of invocations of the methods before the break point.

Hope this helps and hope my description of the alternative in how to track the error helps.

这篇关于iOS EXC_BAD_ACCESS:如何调试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 01:34