iOS NSLayoutConstraint error on Keyboard open

Hi,

My app is currently still using ionic 3, and I noticed a problem on the iOS version:

Whenever I tap an input field (for the first time in its view) I get a huge error log about conflicting NSLayoutConstraints and one being broken.

This apparently seems to have no side effects (everything keeps working fine). However, now I have a new page in which i run programatically “this.input.setFocus()” when user taps a button, and it is NOT working the first time. After first fail, then it works fine every other time. This of course is not nice for the user.

Also, in any scroll view, whenever this constraint is broken, the scrolling/clicking is messed up. the viewport stays as if the keyboard were still up. And you cannot click on the lower part of the screen. Sometimes it gets fixed by tapping in random places.

I know I had face a similar issue a while ago but the solution was to switch to the cordova-plugin-ionic-keyboard (https://github.com/ionic-team/cordova-plugin-ionic-keyboard/) and cordova 8.1.2 …I am still using this configuration.

This is the log:

**[MC] System group container for systemgroup.com.apple.configurationprofiles path is /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles**

**[MC] Reading from public effective user settings.**

**API error: <_UIKBCompatInputView: 0x10113ba20; frame = (0 0; 0 0); layer = <CALayer: 0x28273eec0>> returned 0 width, assuming UIViewNoIntrinsicMetric**

**API error: <_UIKBCompatInputView: 0x10113ba20; frame = (0 0; 0 0); layer = <CALayer: 0x28273eec0>> returned 0 width, assuming UIViewNoIntrinsicMetric**

**[LayoutConstraints] Unable to simultaneously satisfy constraints.**

**Probably at least one of the constraints in the following list is one you don't want.**

**Try this:**

**(1) look at each constraint and try to figure out which you don't expect;**

**(2) find the code that added the unwanted constraint or constraints and fix it.**

**(Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)**

**(**

**"<NSAutoresizingMaskLayoutConstraint:0x280470f50 h=-&- v=-&- _UIToolbarContentView:0x101208030.width == UIToolbar:0x10121c9f0.width (active)>",**

**"<NSLayoutConstraint:0x280442120 H:|-(0)-[_UIButtonBarStackView:0x1011373c0] (active, names: '|':_UIToolbarContentView:0x101208030 )>",**

**"<NSLayoutConstraint:0x2804428f0 _UIButtonBarStackView:0x1011373c0.trailing == _UIToolbarContentView:0x101208030.trailing (active)>",**

**"<NSLayoutConstraint:0x28047eb70 H:|-(16)-[_UIModernBarButton:0x101232d20] (active, names: '|':_UIButtonBarButton:0x1012328d0 )>",**

**"<NSLayoutConstraint:0x28047ebc0 H:[_UIModernBarButton:0x101232d20]-(>=8)-| (active, names: '|':_UIButtonBarButton:0x1012328d0 )>",**

**"<NSLayoutConstraint:0x28047f1b0 H:|-(>=5)-[_UIModernBarButton:0x10114e110] (active, names: '|':_UIButtonBarButton:0x10114dac0 )>",**

**"<NSLayoutConstraint:0x28047f200 H:[_UIModernBarButton:0x10114e110]-(>=5)-| (active, names: '|':_UIButtonBarButton:0x10114dac0 )>",**

**"<NSLayoutConstraint:0x28047fca0 H:|-(8)-[_UIModernBarButton:0x10114f5c0'Done'] (active, names: '|':_UIButtonBarButton:0x10114ea30 )>",**

**"<NSLayoutConstraint:0x28047fcf0 H:[_UIModernBarButton:0x10114f5c0'Done']-(16)-| (active, names: '|':_UIButtonBarButton:0x10114ea30 )>",**

**"<NSLayoutConstraint:0x2804700f0 'UISV-canvas-connection' UILayoutGuide:0x281e58c40'UIViewLayoutMarginsGuide'.leading == _UIButtonBarButton:0x1012328d0.leading (active)>",**

**"<NSLayoutConstraint:0x280470550 'UISV-canvas-connection' UILayoutGuide:0x281e58c40'UIViewLayoutMarginsGuide'.trailing == _UIButtonBarButton:0x10114ea30.trailing (active)>",**

**"<NSLayoutConstraint:0x2804705a0 'UISV-spacing' H:[_UIButtonBarButton:0x1012328d0]-(0)-[UIView:0x10114d8e0] (active)>",**

**"<NSLayoutConstraint:0x2804705f0 'UISV-spacing' H:[UIView:0x10114d8e0]-(0)-[_UIButtonBarButton:0x10114dac0] (active)>",**

**"<NSLayoutConstraint:0x280470640 'UISV-spacing' H:[_UIButtonBarButton:0x10114dac0]-(0)-[UIView:0x10114e850] (active)>",**

**"<NSLayoutConstraint:0x280470690 'UISV-spacing' H:[UIView:0x10114e850]-(0)-[_UIButtonBarButton:0x10114ea30] (active)>",**

**"<NSLayoutConstraint:0x2804710e0 'UIView-Encapsulated-Layout-Width' UIToolbar:0x10121c9f0.width == 0 (active)>",**

**"<NSLayoutConstraint:0x28044e080 'UIView-leftMargin-guide-constraint' H:|-(0)-[UILayoutGuide:0x281e58c40'UIViewLayoutMarginsGuide'](LTR) (active, names: '|':_UIButtonBarStackView:0x1011373c0 )>",**

**"<NSLayoutConstraint:0x28044e120 'UIView-rightMargin-guide-constraint' H:[UILayoutGuide:0x281e58c40'UIViewLayoutMarginsGuide']-(0)-|(LTR) (active, names: '|':_UIButtonBarStackView:0x1011373c0 )>"**

**)**

**Will attempt to recover by breaking constraint**

**<NSLayoutConstraint:0x28047ebc0 H:[_UIModernBarButton:0x101232d20]-(>=8)-| (active, names: '|':_UIButtonBarButton:0x1012328d0 )>**

**Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.**

**The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.**

**[LayoutConstraints] Unable to simultaneously satisfy constraints.**

**Probably at least one of the constraints in the following list is one you don't want.**

**Try this:**

**(1) look at each constraint and try to figure out which you don't expect;**

**(2) find the code that added the unwanted constraint or constraints and fix it.**

**(Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)**

**(**

**"<NSAutoresizingMaskLayoutConstraint:0x280470f50 h=-&- v=-&- _UIToolbarContentView:0x101208030.width == UIToolbar:0x10121c9f0.width (active)>",**

**"<NSLayoutConstraint:0x280442120 H:|-(0)-[_UIButtonBarStackView:0x1011373c0] (active, names: '|':_UIToolbarContentView:0x101208030 )>",**

**"<NSLayoutConstraint:0x2804428f0 _UIButtonBarStackView:0x1011373c0.trailing == _UIToolbarContentView:0x101208030.trailing (active)>",**

**"<NSLayoutConstraint:0x28047f1b0 H:|-(>=5)-[_UIModernBarButton:0x10114e110] (active, names: '|':_UIButtonBarButton:0x10114dac0 )>",**

**"<NSLayoutConstraint:0x28047f200 H:[_UIModernBarButton:0x10114e110]-(>=5)-| (active, names: '|':_UIButtonBarButton:0x10114dac0 )>",**

**"<NSLayoutConstraint:0x28047fca0 H:|-(8)-[_UIModernBarButton:0x10114f5c0'Done'] (active, names: '|':_UIButtonBarButton:0x10114ea30 )>",**

**"<NSLayoutConstraint:0x28047fcf0 H:[_UIModernBarButton:0x10114f5c0'Done']-(16)-| (active, names: '|':_UIButtonBarButton:0x10114ea30 )>",**

**"<NSLayoutConstraint:0x2804700f0 'UISV-canvas-connection' UILayoutGuide:0x281e58c40'UIViewLayoutMarginsGuide'.leading == _UIButtonBarButton:0x1012328d0.leading (active)>",**

**"<NSLayoutConstraint:0x280470550 'UISV-canvas-connection' UILayoutGuide:0x281e58c40'UIViewLayoutMarginsGuide'.trailing == _UIButtonBarButton:0x10114ea30.trailing (active)>",**

**"<NSLayoutConstraint:0x2804705a0 'UISV-spacing' H:[_UIButtonBarButton:0x1012328d0]-(0)-[UIView:0x10114d8e0] (active)>",**

**"<NSLayoutConstraint:0x2804705f0 'UISV-spacing' H:[UIView:0x10114d8e0]-(0)-[_UIButtonBarButton:0x10114dac0] (active)>",**

**"<NSLayoutConstraint:0x280470640 'UISV-spacing' H:[_UIButtonBarButton:0x10114dac0]-(0)-[UIView:0x10114e850] (active)>",**

**"<NSLayoutConstraint:0x280470690 'UISV-spacing' H:[UIView:0x10114e850]-(0)-[_UIButtonBarButton:0x10114ea30] (active)>",**

**"<NSLayoutConstraint:0x2804710e0 'UIView-Encapsulated-Layout-Width' UIToolbar:0x10121c9f0.width == 0 (active)>",**

**"<NSLayoutConstraint:0x28044e080 'UIView-leftMargin-guide-constraint' H:|-(0)-[UILayoutGuide:0x281e58c40'UIViewLayoutMarginsGuide'](LTR) (active, names: '|':_UIButtonBarStackView:0x1011373c0 )>",**

**"<NSLayoutConstraint:0x28044e120 'UIView-rightMargin-guide-constraint' H:[UILayoutGuide:0x281e58c40'UIViewLayoutMarginsGuide']-(0)-|(LTR) (active, names: '|':_UIButtonBarStackView:0x1011373c0 )>"**

**)**

**Will attempt to recover by breaking constraint**

**<NSLayoutConstraint:0x28047f200 H:[_UIModernBarButton:0x10114e110]-(>=5)-| (active, names: '|':_UIButtonBarButton:0x10114dac0 )>**

**Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.**

**The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.**

**[LayoutConstraints] Unable to simultaneously satisfy constraints.**

**Probably at least one of the constraints in the following list is one you don't want.**

**Try this:**

**(1) look at each constraint and try to figure out which you don't expect;**

**(2) find the code that added the unwanted constraint or constraints and fix it.**

**(Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)**

**(**

**"<NSAutoresizingMaskLayoutConstraint:0x280470f50 h=-&- v=-&- _UIToolbarContentView:0x101208030.width == UIToolbar:0x10121c9f0.width (active)>",**

**"<NSLayoutConstraint:0x280442120 H:|-(0)-[_UIButtonBarStackView:0x1011373c0] (active, names: '|':_UIToolbarContentView:0x101208030 )>",**

**"<NSLayoutConstraint:0x2804428f0 _UIButtonBarStackView:0x1011373c0.trailing == _UIToolbarContentView:0x101208030.trailing (active)>",**

**"<NSLayoutConstraint:0x28047fca0 H:|-(8)-[_UIModernBarButton:0x10114f5c0'Done'] (active, names: '|':_UIButtonBarButton:0x10114ea30 )>",**

**"<NSLayoutConstraint:0x28047fcf0 H:[_UIModernBarButton:0x10114f5c0'Done']-(16)-| (active, names: '|':_UIButtonBarButton:0x10114ea30 )>",**

**"<NSLayoutConstraint:0x2804700f0 'UISV-canvas-connection' UILayoutGuide:0x281e58c40'UIViewLayoutMarginsGuide'.leading == _UIButtonBarButton:0x1012328d0.leading (active)>",**

**"<NSLayoutConstraint:0x280470550 'UISV-canvas-connection' UILayoutGuide:0x281e58c40'UIViewLayoutMarginsGuide'.trailing == _UIButtonBarButton:0x10114ea30.trailing (active)>",**

**"<NSLayoutConstraint:0x2804705a0 'UISV-spacing' H:[_UIButtonBarButton:0x1012328d0]-(0)-[UIView:0x10114d8e0] (active)>",**

**"<NSLayoutConstraint:0x2804705f0 'UISV-spacing' H:[UIView:0x10114d8e0]-(0)-[_UIButtonBarButton:0x10114dac0] (active)>",**

**"<NSLayoutConstraint:0x280470640 'UISV-spacing' H:[_UIButtonBarButton:0x10114dac0]-(0)-[UIView:0x10114e850] (active)>",**

**"<NSLayoutConstraint:0x280470690 'UISV-spacing' H:[UIView:0x10114e850]-(0)-[_UIButtonBarButton:0x10114ea30] (active)>",**

**"<NSLayoutConstraint:0x2804710e0 'UIView-Encapsulated-Layout-Width' UIToolbar:0x10121c9f0.width == 0 (active)>",**

**"<NSLayoutConstraint:0x28044e080 'UIView-leftMargin-guide-constraint' H:|-(0)-[UILayoutGuide:0x281e58c40'UIViewLayoutMarginsGuide'](LTR) (active, names: '|':_UIButtonBarStackView:0x1011373c0 )>",**

**"<NSLayoutConstraint:0x28044e120 'UIView-rightMargin-guide-constraint' H:[UILayoutGuide:0x281e58c40'UIViewLayoutMarginsGuide']-(0)-|(LTR) (active, names: '|':_UIButtonBarStackView:0x1011373c0 )>"**

**)**

**Will attempt to recover by breaking constraint**

**<NSLayoutConstraint:0x28047fcf0 H:[_UIModernBarButton:0x10114f5c0'Done']-(16)-| (active, names: '|':_UIButtonBarButton:0x10114ea30 )>**

**Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.**

**The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.**

This is my ionic info:

@ionic/cli-utils  : 1.19.1
ionic (Ionic CLI) : 3.19.1

global packages:

cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1) 

local packages:

@ionic/app-scripts : 3.2.0
Cordova Platforms  : android 6.4.0 ios 4.5.4
Ionic Framework    : ionic-angular 3.9.2

System:

ios-deploy : 1.9.2 
ios-sim    : 5.0.13 
Node       : v6.10.2
npm        : 5.10.0 
OS         : macOS
Xcode      : Xcode 10.2.1 Build version 10E1001
1 Like

Could you open an issue on the keyboard plugin repo? I’ll elevate it and see if we can get to the bottom of this. Please provide a test/project to debug

1 Like

Hi,
thank you. Here´s the issue https://github.com/ionic-team/cordova-plugin-ionic-keyboard/issues/86

I added the link to the demo project at the end, the error I reproduce is not visually the same, but I do get the same big layoutconstraint errors in the console. So I hope it is enough to debug.

Sorry, are there any news on this issue? Did you check out the demo project?

Looked at the post and brought it to the teams attention. thanks!

I must say now that I updated to
cordova 9.0.0
cordova ios 5.0.0

node v10.15.3
npm 6.9.0

the keyboard problems with autofocus and viewport seem to have been solved. Something in the update did the trick.

However, the same long error message about NSLayoutConstraint still pop up in the log every time I click an input field, just as it was shown in the demo project.

For now it is no longer critical, the app works fine, but it does look like something’s not quite right.

Just to update the issue. My App is now also updated to ionic 4 and the NSLayoutConstraint message still pops up on the log.

Hello angelarg, did you fix this issue. I have the same problem whit Ionic 4?

This issue continues to plague users across multiple Cordova platforms. It seems to only happen on first input field focus on both iOS physical devices and iOS simulators- after that it doesn’t trigger again. But the fact that its been happening for so long and Ionic team continues to not resolve it or that no one is able to find a solution is troublesome. At what point does this issue cause an app to break?