Auto Layout Error on iOS 9 with Auto Layout Disabled

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

I get an error message only on iOS 9 in our iPad app. It indicates an NSInternalInconsistencyException .

This happens both in portrait and landscape modes, as well as in many generations of the iPad (iPad 2, iPad Pro, iPad 4, ...).

I don't have auto-layout anywhere in the project , but this seems like an auto-layout problem.

It’s very difficult to replicate, so I can’t debug it on Xcode, but I see reports in the Crashlytics Critical Analysis Service. 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 do not know where in the code this happens. The stack trace does not show where the code crashed. It says only main.m line 16 , which return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); .

+5
source share
3 answers

This line in main.m is where your program starts, and not where an error occurs. The exception is # 1 at the top of the list after all other items have occurred. The problem lies somewhere in between.

After some view has been removed from its supervisor, there is an exception, and it shows NSISEngine errors indicating that AutoLayout may be enabled for some XIB or Storyboard, or iOS uses AutoLayout internally to handle the layout of the new layout.

This answer has an almost identical stack trace and indicates that the problem is using the wrong gesture methods to handle firstResponder changes and disable the keyboard. If you are doing something like this (rejecting some view, editing a UITableView?), Maybe this is the wrong method, pointing to a delegate that does not exist?

/questions/1243603/uitextfield-becomefirstresponder-crashes-the-ios-app-randomly

+1
source

The stack displays a problem with the onscreen keyboard. There is a layout change that ends with a non-exsistant delegate. It looks like your code triggers a direct or indirect shunting exchange associated with the keyboard. The fact is that the keyboard on the screen is not solved even when your application restores input.

As for the iPad Pro and the smart keyboard, you may have a quick panel type, and this can also be hidden. Some applications have problems with external keyboards.

Try connecting a Bluetooth keyboard to one of your test devices. Connect it to xcode, set a breakpoint on exceptions and try text fields. Guess what you find what you are looking for.

0
source

Perhaps you may have an error with any viewcontroller or xib manager during its launch, or you may have changed the file name or moved it to a physical folder and forgot to remove it from xcode.

0
source

Source: https://habr.com/ru/post/1243601/


All Articles