I have been trying to solve this for the past two days. Unable to understand why my app crashes.
I'm using JASidePanel
library to achieve panel effect in my app. The left side panel is a tableview which acts like navigation guide for the centre panel. In one scenario, when a particular option is selected in the left side panel (when this is open), the centre panel is supposed to just close the left side panel and present another navigation controller (with a consistent) root view controller. However, sometimes this transition crashes my app.
I observed that the crash does not happen in the JASidePanel's code or my Centre panel View Controller code ([self presentViewController:self.cityNavigationController animated:YES completion:nil];
). I clearly observed that the app crashes due to some internal crash because of the iOS framework, I went through each instruction by instruction and figured this out.
But still, I think I'm doing something wrong. Can anyone suggest me why this crash could happen? What should I be looking for to resolve this issue? Any steps or procedures I can/should follow to detect the problem?
Any help is appreciated.
Device Log:
Thread 0 Crashed:
0 libobjc.A.dylib 0x3a085b26 objc_msgSend + 6
1 UIKit 0x3257c788 -[UISearchBar _didMoveFromWindow:toWindow:] + 152
2 UIKit 0x3249a576 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 662
3 UIKit 0x3249a576 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 662
4 UIKit 0x324bb5e2 -[UIScrollView _didMoveFromWindow:toWindow:] + 46
5 UIKit 0x3249a576 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 662
6 UIKit 0x3249a576 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 662
7 UIKit 0x3249a576 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 662
8 UIKit 0x3249a576 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 662
9 UIKit 0x32499e68 __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 108
10 Foundation 0x30688d98 -[NSISEngine withBehaviors:performModifications:] + 208
11 UIKit 0x32499cf2 -[UIView(Hierarchy) _postMovedFromSuperview:] + 294
12 UIKit 0x324a6998 -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1400
13 UIKit 0x324a6412 -[UIView(Hierarchy) addSubview:] + 26
14 UIKit 0x32587d8a -[UITransitionView transition:fromView:toView:removeFromView:] + 974
15 UIKit 0x32587998 -[UIViewControllerBuiltinTransitionViewAnimator animateTransition:] + 444
16 UIKit 0x32587406 __101-[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:animation:]_block_invoke_2 + 1250
17 UIKit 0x3251afb6 _applyBlockToCFArrayCopiedToStack + 314
18 UIKit 0x324931ee _afterCACommitHandler + 426
19 CoreFoundation 0x2fcf31ca __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 18
20 CoreFoundation 0x2fcf0b6c __CFRunLoopDoObservers + 280
21 CoreFoundation 0x2fcf0eae __CFRunLoopRun + 726
22 CoreFoundation 0x2fc5bc22 CFRunLoopRunSpecific + 518
23 CoreFoundation 0x2fc5ba06 CFRunLoopRunInMode + 102
24 GraphicsServices 0x3493a27e GSEventRunModal + 134
25 UIKit 0x324ff044 UIApplicationMain + 1132
26 Housing India 0x000a2606 main (main.m:16)
27 libdyld.dylib 0x3a592ab4 start + 0
Well, If for any one this helps.
The problem was with the iOS Framework. The problem was with UINavigationController's implementation. The crash was happening inside the framework itself. The only possible way out was to instantiate the Navigation Controller every time, before presenting it. This decreases performance, but had no other option. Apple, really does have a lot of limitations and assumptions. :P
Explanation: We needed to present a Navigation Controller with Modal animation. We were trying to avoid the instantiation of the navigation controller again and again by instantiating it once and trying to reuse it. However, because of this, we observed a crash happening sometime. Don't exactly know what the crash means, but fixed it by instantiating it again and again.