Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS NSLayoutConstraint error on Keyboard open #86

Closed
AngelaRg opened this issue Apr 30, 2019 · 9 comments
Closed

iOS NSLayoutConstraint error on Keyboard open #86

AngelaRg opened this issue Apr 30, 2019 · 9 comments

Comments

@AngelaRg
Copy link

AngelaRg commented Apr 30, 2019

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 and cordova 8.1.2 …I am still using this configuration. (I believe it also happens with cordova 9.0.0)

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

I was able to reproduce the error (in a simpler way) in this project:
https://github.com/CesarRubenAlejandro/IonicDemoAppKeyboard

@mhartington
Copy link
Member

CC @jcesarmobile @manucorporat.

@Huy-Vu
Copy link

Huy-Vu commented May 29, 2019

I am having same issue! Any updates yet?

@AngelaRg
Copy link
Author

AngelaRg commented Jun 3, 2019

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.

@eddskt
Copy link

eddskt commented Jun 4, 2019

Any Solution?

@MitchEff
Copy link

Mine started doing the same at the same time as automatically scrolling to the top of the page on focus/blur. Seems like in iOS12 thing.

@kennethross
Copy link

Having the same problem. My login button was not able to press after the keyboard close

@jcesarmobile
Copy link
Member

Closing as the reporter said it was solving after updating and I couldn't reproduce on the sample app.

The problem about the views being wrong (i.e. buttons not clickable) was a WKWebView bug that was workarounded on cordova-plugin-ionic-webview long ago ionic-team/cordova-plugin-ionic-webview#176

The NSLayoutConstraint errors are really Apple bugs, not our fault, nor we can fix them, but they are harmless.

@eppineda
Copy link

FWIW, I ran into OP's runtime errors myself in iOS 12 on various iPad models, however they do not occur in iOS 13 (beta), at least not so far.

@yosikal
Copy link

yosikal commented Sep 24, 2019

I'm seeing a lot of those errors on iOS 13 and for me it's causing the cursor to be gone from text elements. Anyway to workaround it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants