已将EXC_BAD_ACCESS消息发送到已释放实例,但是我正在使用ARC? [英] EXC_BAD_ACCESS message sent to deallocated instance, but I'm using ARC?

查看:132
本文介绍了已将EXC_BAD_ACCESS消息发送到已释放实例,但是我正在使用ARC?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个从SOAP Web服务获取信息的应用程序,我想在UITableView中显示结果.

我有此应用程序的先前版本,并且我正在创建一个新版本,以基本上进行清理并摆脱一堆已弃用且不再使用的旧代码.

在以前的版本中,此方法效果很好.在新版本中,没有那么多.

基本上,当前情况是返回3个字符串,我正在尝试将这些字符串用作UITableView中数据的基础.

我正在努力解决此问题,因为很难追踪EXC_BAD_ACCESS错误!

(从本质上讲,如果有人有办法使调试体验更像Visual Studio,我很想听听它!真是令人沮丧,不知道是哪条线导致了错误,也无法做到这一点.在崩溃时仔细检查我的局部变量,看看是什么.我已经在异常断点中添加了,但这似乎没有多大作用.)

无论如何,导致错误"APPEARS"的行为:

return [[self Libraries] count];

它出现在tableView:numberOfRowsInSection:中.

出现错误消息,提示我引用了应该存储在NSMutableArray [self Libraries]中的字符串.

这是怎么回事?
我正在使用 ARC ,所以不应该正确处理我所有的内存管理吗?
我的代码中没有任何手动发布声明!

请帮助我解决此问题!

解决方案

设置 NSZombieEnabled MallocStackLogging 有关详细说明,请参阅本文.

I've got an app that gets information from a SOAP web service and I want to display the results in a UITableView.

I had a previous version of this app and I'm creating a new version to basically clean things up and get rid of a bunch of legacy code that's deprecated and no longer used.

In the previous version, this worked well. In the new version, not so much.

Basically, the current scenario is returning 3 strings that I'm trying to use as the basis for the data in my UITableView.

I'm struggling with this issue because it's so stinkin' hard to track down EXC_BAD_ACCESS errors!

(Parenthetically, if someone has a way to make the debug experience more like Visual Studio, I'd love to hear it! It's so frustrating to not have any idea which line caused the error, and also to not be able to look through my local variables at the time of the crash to see what's what. I've already added in the exception breakpoint, but that doesn't seem to do much.)

Anyway, the line that's causing the error APPEARS to be:

return [[self Libraries] count];

It occurs in tableView:numberOfRowsInSection:.

The error message I get APPEARS to reference a string that should be stored in the NSMutableArray [self Libraries].

What's going on here?
I'm using ARC, so shouldn't all of my memory management be correctly handled?
I don't have any manual release statements in my code ANYWHERE!

Please help me fix this!

解决方案

Set NSZombieEnabled, MallocStackLogging, and guard malloc in the debugger. Then, when your App crashes, type this in the gdb console:

(gdb) info malloc-history 0x543216

Replace 0x543216 with the address of the object that caused the crash, and you will get a much more useful stack trace and it should help you pinpoint the exact line in your code that is causing the problem.

See this article for more detailed instructions.

这篇关于已将EXC_BAD_ACCESS消息发送到已释放实例,但是我正在使用ARC?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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