线程1:EXC_BAD_ACCESS(代码= 1,地址= 0xf1759018) [英] Thread 1: EXC_BAD_ACCESS (code=1, address=0xf1759018)

查看:95
本文介绍了线程1:EXC_BAD_ACCESS(代码= 1,地址= 0xf1759018)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我收到此错误(下图).遇到此错误时,正在通过我的核心数据数据库,然后根据我收集的电池统计信息对结果求平均值,这是怎么回事.直到我休息一会儿再回来,将其插入并开始收到此错误之前,此方法一直运行良好.我有一个异常断点,但是除了图像崩溃以外,它没有显示任何其他信息.

So I am getting this error (picture below). What is happening when I get this error is going through my core data data base and averaging out results based on battery statistics that I have collected. This was working fine until I took a break and then came back, plugged it in and it started getting this error. I have an exception breakpoint, but it is still not showing me anything other than the crash in the image.

有人知道我应该怎么做吗?

Anyone know what i should do?

xcode 5.0版

xcode Version 5.0

让我知道我是否可以发布其他任何有助于找出原因的信息!

Let me know if i can post anything else that can help figure out what is causing this!

推荐答案

对于任何EXC_BAD_ACCESS错误,您通常试图将消息发送到已发布的对象.跟踪这些问题的最佳方法是使用 NSZombieEnabled .

For any EXC_BAD_ACCESS errors, you are usually trying to send a message to a released object. The BEST way to track these down is use NSZombieEnabled.

此方法的工作原理是从不实际释放对象,而是将其包装为僵尸"并在其内部设置一个标记,表明该对象通常会被释放.这样,如果您再次尝试访问它,它仍然会在错误发生之前知道它是什么,并且有了这些少量信息,您通常可以回溯以查看问题出在哪里.

This works by never actually releasing an object, but by wrapping it up as a "zombie" and setting a flag inside it that says it normally would have been released. This way, if you try to access it again, it still know what it was before you made the error, and with this little bit of information, you can usually backtrack to see what the issue was.

当调试器有时会发掘任何有用的信息时,它在后台线程中特别有用.

It especially helps in background threads when the Debugger sometimes craps out on any useful information.

非常重要的一点,但是,您需要100%确保这仅在调试代码中,而不是在XCode之外测试的任何代码.由于从未发布过任何内容,因此您的应用程序将泄漏,泄漏和泄漏.为了提醒我执行此操作,我将此日志放在我的appdelegate中:

VERY IMPORTANT TO NOTE however, is that you need to 100% make sure this is only in your debug code and not any code you are testing outside of XCode. Because nothing is ever released, your app will leak and leak and leak. To remind me to do this, I put this log in my appdelegate:

if (getenv("NSZombieEnabled"))
  NSLog(@"NSZombieEnabled!");

如果您需要帮助以找到确切的行,请构建并运行.当应用程序崩溃时,调试器将向您确切显示哪一行,并与NSZombieEnabled结合使用,您应该能够确切找到释放对象后为什么访问该对象以及访问哪种类型的对象.

If you need help finding the exact line, Build-and-Run. When the app crashes, the debugger will show you exactly which line and in combination with NSZombieEnabled, you should be able to find out exactly why and what type of object is being accessed after being released.

这篇关于线程1:EXC_BAD_ACCESS(代码= 1,地址= 0xf1759018)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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