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

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

问题描述

好的,这是交易,我仇恨提出关于我的调试和崩溃的问题。因为我通常自己处理,但我只是不能解决这个问题,即使在已经查看多个问题之后。



好的,这里是问题,我发现我的应用程序随机打开和关闭崩溃与这个堆栈跟踪:

  ** *  -  [ViewController responsesToSelector:]:消息发送到deallocated实例0x1e5d2ef0 

其中 ViewController 可能有所不同,有时候我的代码崩溃的地方,与 ViewController 相关性,



此外,为了得到控制台跟踪,我启用了僵尸,否则我将没有控制台打印,我只能得到: objc_msgSend ,我知道这意味着我正在发送的东西。但我不能找到这是...我真的卡住了!通常我总是调试我的崩溃,所以我真的很困扰这个。



再次,这种崩溃在不同的地方在不同的时间,关闭。而且崩溃的地方与 ViewController 几乎相关。我觉得这很混乱。



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



我试图添加符号断点没有运气,僵尸不适用于iOS的仪器应用程序。我无法在模拟器上运行我的应用程序,因为它有不支持的架构框架。



感谢大家...

解决方案

使用仪器跟踪取消分配的实例错误。为您的应用程式设定个人资料( Cmd⌘ + I ),然后选择[Zombies]范本。应用程序运行后,尝试崩溃。您应该得到类似的结果:





点击弹出框中地址旁边的箭头,显示被释放后被调用的对象。



>



现在应该看到每个调用都改变了这个对象的保留计数。这可能是因为发送直接保留/释放消息以及排空自动释放池或插入NSArrays。



调用和 Responsible Caller 显示类名称和执行方法。当您双击任何保留/释放,仪器将显示您执行此行的代码行(如果这不工作,您可以通过选择它并选择它的对应物在扩展详细信息



这将让你检查对象的所有 retainCount 生命周期,也许你马上就会发现你的问题。您所要做的就是找到最新的发布缺少


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

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.

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.

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!

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.

Thanks everyone...

解决方案

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.

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 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):

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

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