修复了我的应用程序

修复了我的应用程序

本文介绍了NSZombieEnabled 修复了我的应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我推送某个视图控制器,然后弹出它,然后重复看似随机的次数,应用程序最终崩溃并出现错误 EXC_BAD_ACCESS.

When I push a certain view controller, then go pop it and then repeat a seemingly random number of times the app eventually crashes with the error EXC_BAD_ACCESS.

这我每次都能可靠地复制.它主要发生在我第二次弹出视图控制器时,但有时可能是第三次或第四次.

This I can reliably replicate EVERY TIME. It happens mostly the second time I pop the view controller, but sometimes it can be the third or fourth.

所以我决定设置 NSZombieEnabled 来查看问题所在.

So I decided to set NSZombieEnabled to see what the problem was.

但启用此功能后,无法复制崩溃.所改变的只是我在我的活动可执行文件的配置中选中NSZombieEnabled"旁边的框,并且该应用程序运行良好.

But with this enabled the crash can't be replicated. All thats changed is I check the box next to "NSZombieEnabled" in my active executable's config and the app works perfectly.

任何想法是什么原因造成的?

Any ideas what is causing this?

谢谢

推荐答案

我在模拟器中使用 iPhone 应用时遇到了同样的问题.当我弹出一个特定的视图控制器时,它会抛出一个 EXC_BAD_ACCESS,但是一旦 NSZombieEnabled 开启,错误就消失了.

I had this same problem with an iPhone app in simulator. It would throw an EXC_BAD_ACCESS when I popped a particular view controller but as soon as NSZombieEnabled was on, the error vanished.

为了缩小范围,我注释掉了弹出视图控制器的 dealloc 中的所有版本,以防止应用程序崩溃,然后一次取消注释它们,直到它再次崩溃,揭示了有问题的变量.

To narrow it down, I commented out all the releases in the popped view controller's dealloc, which kept the app from crashing, and then uncommented them one at a time until it crashed again, revealing the offending variable.

在我的例子中,实际上是变量的释放语句本身抛出了 EXC_BAD_ACCESS

In my case, it was actually the variable's release statement itself that was throwing the EXC_BAD_ACCESS

除了不发布之外,我无法确切地告诉您如何从那里修复它.在调整和清理代码后,我能够让它正常工作,但是当我尝试回滚更改以再次获取错误并缩小精确修复范围时,我无法复制问题.我实际上在第一次回滚时就得到了它,但再也没有.也许有一些环境因素在起作用?

I can't tell you exactly how to fix it from there other than to not release. I was able to get it working fine after tweaking and cleaning the code but when I try to roll back the changes to get the error again and narrow down the precise fix, I was unable to replicate the problem. I actually got it on the first roll back but never again. Maybe there's something environmental at work?

这不是一个确切的答案,但也许它会为某人指明正确的方向.

This isn't an answer exactly but maybe it'll point someone in the right direction.

这篇关于NSZombieEnabled 修复了我的应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 00:05