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

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

问题描述

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

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 可以变化的地方,有时是我的代码崩溃的地方,与那个特定的 ViewController 没有相关性,并且不拥有或调用它.

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!

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

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 列显示调用操作后的保留计数,Responsible Caller 显示执行操作的类名和方法.当您双击任何保留/释放时,仪器将向您显示执行此操作的代码行(如果这不起作用,您可以通过选择它并在扩展详细信息中选择其对应项来检查调用窗格):

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 生命周期,您可能会立即发现问题.您所要做的就是找到缺失的保留以获取最新的发布.

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:消息发送到释放实例(崩溃)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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