ViewController respondsToSelector:发送到已释放实例的消息(CRASH) [英] ViewController respondsToSelector: message sent to deallocated instance (CRASH)

查看:19
本文介绍了ViewController respondsToSelector:发送到已释放实例的消息(CRASH)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,这就是交易,我讨厌提出有关我的调试和崩溃的问题.因为我通常自己处理它们,但我只是无法解决这个问题,即使在已经查看了多个问题之后也是如此.

Ok, here is the deal, I hate putting out questions about my debugging and crashes. Because I usually handle them myself, but I just cannot get my way around this, even after viewing multiple questions already.

好的,这就是问题所在,我发现我的应用程序随机打开和关闭,并出现此堆栈跟踪:

Ok so here is the problem, I find my app randomly on and off crashing with this stack trace:

*** -[ViewController respondsToSelector:]: message sent to deallocated instance 0x1e5d2ef0

ViewController 的位置可能会有所不同,有时我的代码崩溃的位置与特定的 ViewControllerNO 相关性并且不属于或调用它.

Where ViewController can vary, sometimes the place where my code crashes, has NO relevance to that particular ViewController and doesn't own or call it.

另外,为了获得控制台跟踪,我启用了 Zombies,否则我根本不会得到控制台打印,我只会得到:objc_msgSend,我知道这意味着我正在发送消息释放.但我找不到那在哪里......我真的被困住了!通常我总是调试我的崩溃,所以我真的坚持这一点.

Also, to get that console trace, I have enabled Zombies, otherwise I would get no console print at all, I would only get: objc_msgSend, which I know means I am messaging something that is released. But I cannot find where that is... I am really stuck! Usually I always debug my crashes, so I am really stuck on this.

同样,这会在不同的时间和不同的地方崩溃,打开和关闭.它崩溃的地方与 ViewController 几乎没有相关.我觉得这很令人困惑.

Again, this crashes in different places at different times, on and off. And the place it crashes has almost no relevance to the ViewController. And I find this very confusing.

您需要我的任何代码吗?我有很多文件,由于它在不同的地方崩溃,分发我的代码将是一团糟!

Do you need any of my code? I have a lot of files and since it is crashing in different places, distributing my code will be a mess!

我尝试添加符号断点,但没有成功,并且 Zombies 在 iOS 的 Instruments 应用程序中不可用.我无法在模拟器上运行我的应用,因为它的架构框架不支持它.

I have tried to add symbolic breakpoints with no luck, and Zombies is not available on the Instruments application for iOS. I cannot run my app on the simulator as it has unsupportive architecture frameworks for it.

谢谢大家...

推荐答案

使用 Instruments 来追踪解除分配的实例错误.分析您的应用程序 (Cmd ⌘+I) 并选择 Zombies 模板.应用程序运行后,尝试使其崩溃.你应该得到类似的东西:

Use Instruments to track down deallocated instance errors. Profile your application (Cmd ⌘+I) and choose Zombies template. After your application is running, try to crash it. You should get something like that:

单击弹出窗口中地址旁边的箭头以显示在释放后调用的对象.

Click on the arrow next to address in the popover to show object that was called after it was deallocated.

您现在应该看到每个更改了此对象保留计数的调用.这可能是因为直接发送保留/释放消息以及耗尽自动释放池或插入 NSArrays.

You should see now every call that has changed retain count of this object. This could be because sending directly retain/release messages as well as draining autorelease pools or inserting into NSArrays.

RefCt 列显示调用操作后的 retainCount,Responsible Caller 显示执行该操作的类名和方法.当您双击任何保留/释放时,仪器将向您显示执行此操作的代码行(如果这不起作用,您可以通过选择它并在 Extended Detail 中选择它的对应项来检查调用窗格):

RefCt column shows retainCount after action was invoked and Responsible Caller shows class name and method in which it was performed. When you double click on any retain/release, instruments will show you line of code where this was performed (If this isn't working, you can examine call by selecting it and choosing its counterpart in Extended Detail pane):

这将让您检查对象的所有 retainCount 生命周期,并且您可能会立即发现问题.您所要做的就是找到最新的版本缺少的retain.

This will let you examine all the retainCount lifecycle of object and probably you'll find your problem right away. All you got to do is find missing retain for latest release.

这篇关于ViewController respondsToSelector:发送到已释放实例的消息(CRASH)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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