Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Auto-Layout crash on iOS 9 with auto-layout disabled

I know this is a generic question, but I hope that someone who had a similar experience may have an idea of what's probably happening.

I'm getting a crash that occurs only on iOS 9 in our iPad-only app. It says NSInternalInconsistencyException.

It occurs on both Portrait and Landscape modes, and on many iPad generations (iPad 2, iPad Pro, iPad 4, ...).

I don't have Auto Layout enabled anywhere in the project, yet it looks like an auto layout issue.

It's very hard to replicate, so I'm not able to debug it on Xcode, but I'm seeing reports on the crash analytics service "Crashlytics". Here's the stack trace from Crashlytics:

Auto layout internal error. Cannot find an outgoing row 
head for incoming head <unknown var (bug!) with engine as delegate[...]

Thread : Fatal Exception: NSInternalInconsistencyException
0  CoreFoundation                 0x23d4568b __exceptionPreprocess
1  libobjc.A.dylib                0x356c2e17 objc_exception_throw
2  CoreFoundation                 0x23d455d1 -[NSException initWithCoder:]
3  Foundation                     0x24a873b3 -[NSISEngine minimizeConstantInObjectiveRowWithHead:]
4  Foundation                     0x24a86e4d -[NSISEngine optimize]
5  Foundation                     0x24a82a53 -[NSISEngine withBehaviors:performModifications:]
6  UIKit                          0x27e040bb -[UIView(Hierarchy) _postMovedFromSuperview:]
7  UIKit                          0x280fb227 __UIViewWasRemovedFromSuperview
8  UIKit                          0x27e02ddb -[UIView(Hierarchy) removeFromSuperview]
9  UIKit                          0x282e5fa9 -[UIKeyboardPredictionView setPredictionViewState:animate:notify:]
10 UIKit                          0x281e3787 -[UIKeyboardImpl updatePredictionView]
11 UIKit                          0x27f155e3 -[UIKeyboardImpl finishLayoutChangeWithArguments:]
12 UIKit                          0x27e31437 -[UIKeyboardImpl updateLayout]
13 UIKit                          0x27e36077 -[UIKeyboardImpl setDelegate:force:]
14 UIKit                          0x27e2f6e1 -[UIPeripheralHost(UIKitInternal) _reloadInputViewsForResponder:]
15 UIKit                          0x27e2f20d -[UIResponder(UIResponderInputViewAdditions) reloadInputViews]
16 UIKit                          0x27e8d853 -[UIResponder becomeFirstResponder]
17 UIKit                          0x27e8db6d -[UIView(Hierarchy) becomeFirstResponder]
18 UIKit                          0x27f12289 -[UITextField becomeFirstResponder]
19 UIKit                          0x27fbe69f -[UITextInteractionAssistant(UITextInteractionAssistant_Internal) setFirstResponderIfNecessary]
20 UIKit                          0x27fbdc75 -[UITextInteractionAssistant(UITextInteractionAssistant_Internal) oneFingerTap:]
21 UIKit                          0x28334e27 _UIGestureRecognizerSendTargetActions
22 UIKit                          0x27fa2303 _UIGestureRecognizerSendActions
23 UIKit                          0x27e3a7af -[UIGestureRecognizer _updateGestureWithEvent:buttonEvent:]
24 UIKit                          0x28335f2f ___UIGestureRecognizerUpdate_block_invoke809
25 UIKit                          0x27dfc287 _UIGestureRecognizerRemoveObjectsFromArrayAndApplyBlocks
26 UIKit                          0x27df9e77 _UIGestureRecognizerUpdate
27 UIKit                          0x27e386f9 -[UIWindow _sendGesturesForEvent:]
28 UIKit                          0x27e37e43 -[UIWindow sendEvent:]
29 UIKit                          0x27e097e5 -[UIApplication sendEvent:]
30 UIKit                          0x27e07fdf _UIApplicationHandleEventQueue
31 CoreFoundation                 0x23d08c3f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
32 CoreFoundation                 0x23d0882d __CFRunLoopDoSources0
33 CoreFoundation                 0x23d06b9b __CFRunLoopRun
34 CoreFoundation                 0x23c5a249 CFRunLoopRunSpecific
35 CoreFoundation                 0x23c5a035 CFRunLoopRunInMode
36 GraphicsServices               0x2cd24ad1 GSEventRunModal
37 UIKit                          0x27e6f899 UIApplicationMain
38 Mr Appliance                   0xcda7b main (main.m:16)
39 libdyld.dylib                  0x35e0e873 start

The problem is that I don't know where in the code this is happening. The stack trace doesn't show where in the code the crash is occurring. It only says main.m line 16 which is return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));.

like image 870
Carl Avatar asked Nov 09 '22 19:11

Carl


1 Answers

That line in main.m is where your program starts running, not where the error happens. The exception is thrown at #1 the top of the list after all the other items have happened. The problem lies somewhere in between.

After some view is removed from its superview there's an exception, and it does show NSISEngine errors indicating that perhaps AutoLayout is turned on for some XIB or Storyboard - or else iOS is using AutoLayout internally to handle the arrangement of the new layout.

This answer has a nearly identical stack trace & points to the issue being with using incorrect gesture methods to handle firstResponder changes and dismiss a keyboard. If you're doing something similar (dismissing some view, editing a UITableView?) maybe it's with the wrong method pointing to a delegate that doesn't exist?

https://stackoverflow.com/questions/33800918/uitextfield-becomefirstresponder-crashes-the-ios-app-randomly

like image 115
mc01 Avatar answered Nov 15 '22 07:11

mc01