Enable Zombie Objects is not enough to help debug my issue - what else can I do?

こ雲淡風輕ζ 提交于 2019-12-12 01:57:41

问题


I'm getting the following runtime error and I cannot determine for the life of me WHYYYY. The error is Thread 1: EXC_BREAKPOINT (code=EXC_1386_BPT, subcode=0x0) which seems to happen whenever I execute the dismissModalViewController:animated or the pushViewController:animated method from any of my VC's.

I have enabled zombie objects and that shows me the following message in the debugger, 2012-06-14 16:34:58.769 MyApp[5952:17903] *** -[MyDetailsVC respondsToSelector:]: message sent to deallocated instance 0x8c3d400.

This ONLY happens after I access the MyDetailsVC ViewController. The scenario is as follows.

  • start the app, everything works perfectly, I can push to and pop from view controllers and present and dismiss modal VC's without any issues.
  • I push to the MyDetailsVC, do nothing on it, then tap the back button.
  • I'm now back to where I was before pushing to the MyDetailsVC, the app continues to work perfectly until I reach a point where I have to push to a VC or present a modal VC. I then get the runtime error.

The MyDetailsVC is not even in the picture nor does it have anything to do with the other VC's when I encounter the error.

How can I get more granular with the debugger in order to determine what this issue is?

Also, the error message says the words "message sent", so I've pretty much commented all of my NSNotifications in my VC's to rule out the chance that one of my VC's is trying to send a message to a VC that is no longer alive... no luck!

PS - I'm using Xcode 4.3.1, 5.1 w/ ARC


回答1:


Nothing in callback stack in debugger to show you which line of your code is happening?

respondsToSelector is called a lot on delegates (to see if an optional method in a protocol is implemented). Did your MyDetailsVC assign itself as a delegate to anything? If so, be sure and assign xyz.delegate = nil in your dealloc routine.

So you probably have "self.navigationController.delegate = self". So, you need a matching "self.navigationController.delegate = nil" in your dealloc routine.




回答2:


The issue is not NSNotifications. Messages in objective-c are just function/method calls. It looks like respondsToSelector: is causing the issue.

Check if MyDetailsVC has [self respondsToSelector:@"some method here"]. Also it could be that another objects calls respondsToSelector on MyDetailsVC after MyDetailsVC was dismissed and deallocated. Make sure in MyDetailsVC under viewDidUnload you set @synthesized properties to nil and stopped all pending performSelector calls.



来源:https://stackoverflow.com/questions/11043067/enable-zombie-objects-is-not-enough-to-help-debug-my-issue-what-else-can-i-do

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!