3

I have the following crash report. It only happens on iOS 8. I know exactly how to reproduce it but cannot for the life of me figure out where the problem is in my code. When I use a breakpoint and try to step through the app, the crash doesn't happen. How can I find where the issue is in my app?

Exception Type:  SIGSEGV
Exception Codes: SEGV_ACCERR at 0x10
Crashed Thread:  0

    Application Specific Information:
objc_msgSend() selector name: respondsToSelector:

Thread 0 Crashed:
0   libobjc.A.dylib                      0x00000001974b3bd0 objc_msgSend + 16
1   UIKit                                0x000000018ab960f4 -[UIToolbar _didMoveFromWindow:toWindow:] + 108
2   UIKit                                0x000000018aa30d44 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 700
3   UIKit                                0x000000018aa30d44 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 700
4   UIKit                                0x000000018aa30d44 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 700
5   UIKit                                0x000000018aa303dc __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 140
6   UIKit                                0x000000018aa302bc -[UIView(Hierarchy) _postMovedFromSuperview:] + 480
7   UIKit                                0x000000018aa3c0b0 -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1788
8   UIKit                                0x000000018ac1c368 __53-[_UINavigationParallaxTransition animateTransition:]_block_invoke + 1432
9   UIKit                                0x000000018aa42b6c +[UIView(Animation) performWithoutAnimation:] + 84
10  UIKit                                0x000000018ac1bb2c -[_UINavigationParallaxTransition animateTransition:] + 852
11  UIKit                                0x000000018abd7b70 -[UINavigationController _startCustomTransition:] + 3032
12  UIKit                                0x000000018aae9ef0 -[UINavigationController _startDeferredTransitionIfNeeded:] + 464
13  UIKit                                0x000000018aae9cbc -[UINavigationController __viewWillLayoutSubviews] + 52
14  UIKit                                0x000000018aae9c3c -[UILayoutContainerView layoutSubviews] + 196
15  UIKit                                0x000000018aa31760 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 576
16  QuartzCore                           0x000000018a379e1c -[CALayer layoutSublayers] + 148
17  QuartzCore                           0x000000018a374884 CA::Layer::layout_if_needed(CA::Transaction*) + 316
18  QuartzCore                           0x000000018a374728 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 28
19  QuartzCore                           0x000000018a373ebc CA::Context::commit_transaction(CA::Transaction*) + 272
20  QuartzCore                           0x000000018a373c3c CA::Transaction::commit() + 524
21  QuartzCore                           0x000000018a36d364 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 76
22  CoreFoundation                       0x0000000185fac2a4 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 28
23  CoreFoundation                       0x0000000185fa9230 __CFRunLoopDoObservers + 356
24  CoreFoundation                       0x0000000185fa9610 __CFRunLoopRun + 832
25  CoreFoundation                       0x0000000185ed52d4 CFRunLoopRunSpecific + 392
26  GraphicsServices                     0x000000018f59b6fc GSEventRunModal + 164
27  UIKit                                0x000000018aa9afac UIApplicationMain + 1484
28  MyAppName                            0x00000001001b8ae0 main (main.m:16)
29  libdyld.dylib                        0x0000000197b1ea08 start + 0
rmaddy
  • 314,917
  • 42
  • 532
  • 579
Zia
  • 14,622
  • 7
  • 40
  • 59

1 Answers1

18

I know exactly how to reproduce it

That alone is worth its weight in gold.

This is a memory management issue. You will need to replicate the conditions of the crash with Zombies turned on. Some object has vanished out from under its pointer, and Zombies will tell you what object it is.

Keep in mind that the moment of the crash probably has nothing to do with the cause of the issue. The moment of the crash is diagnostic only. The object that has vanished, probably vanished long before; it is only now, though, that someone is trying to send a message to it, only to find that it is no longer home.

(For example, a Cocoa class that takes a delegate and whose delegate has been destroyed would cause this kind of issue. The delegate is not retained, so the Cocoa class doesn't know anything has happened. The solution would be then that you would need to set the delegate to nil before that delegate goes out of existence. I'm not saying that's the specific issue; I'm just giving an example of how this kind of thing happens.)

matt
  • 515,959
  • 87
  • 875
  • 1,141
  • Thank you for taking the time to write such a thorough response. I went as far as finding the Zombie. Now I have to figure out why my main VC is turning into a zombie when it tells the nav controller to push another VC. – Zia Jun 04 '15 at 23:56
  • 1
    "Now I have to figure out why my main VC is turning into a zombie when it tells the nav controller to push another VC" Once again, though, your words are golden. The fact that you can specify so exactly what's wrong surely means you're nine-tenths of the way to a solution. - If you can chart the structure of your view controllers and show what you're doing as you push onto the nav controller stack, perhaps you could ask a new question about this (if you don't figure it out yourself). – matt Jun 05 '15 at 00:53
  • I'm a little worried by the mention in the call stack of `fromWindow:toWindow:`; you should not have multiple windows (but maybe you don't actually)... – matt Jun 05 '15 at 00:53
  • I don't explicitly create another window at any point. Also, the zombie is being called on my a toolBar but there is no where I set that VC as a delegate of a toolbar. – Zia Jun 05 '15 at 00:56
  • Yes, maybe the window thing is just some internal trick. That's why I said "maybe you don't". - Maybe try a process of elimination? If the crash is reproducible, maybe just remove the toolbar and try it again. If that solves it, the toolbar is implicated somehow. :) – matt Jun 05 '15 at 01:09