2

I have built a simple hybrid app with a single view controller in which I have placed a single UIWebView which loads an embedded HTM5L/CSS/JS web app.

Whenever my app is run and the web view requires user input, the on screen keyboard appears, the web view shrinks to the remaining space above the keyboard, the user enters text, presses "Done" and the on-screen keyboard disappears. To the user the app is working fine.

However on the XCode console there are are large number of errors copied in to the question below. As far as I know, these errors were not there before XCode 9, at least I never noticed them and I think I would have given their size.

Any help on how to resolve these errors is most appreciated. You could quite rightly say, read the error messages, however I have done this for a while and what confuses me is that I do not have any UIButtonBars nor any UIToolBars Thanks.

<_UIKBCompatInputView: 0x10be39850; frame = (0 0; 0 0); layer = <CALayer: 0x1c0024be0>> returned 0 width, assuming UIViewNoIntrinsicMetric
2018-07-12 16:42:30.828370+0100 MyApp[3763:346405] API error: <_UIKBCompatInputView: 0x10be39850; frame = (0 0; 0 0); layer = <CALayer: 0x1c0024be0>> returned 0 width, assuming UIViewNoIntrinsicMetric
2018-07-12 16:42:30.873906+0100 MyApp[3763:346405] [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:0x1c0284380 h=-&- v=-&- _UIToolbarContentView:0x10be1e090.width == UIToolbar:0x10be1dc50.width   (active)>",
    "<NSLayoutConstraint:0x1c0096b70 H:|-(8)-[_UIButtonBarStackView:0x10be1f620]   (active, names: '|':_UIToolbarContentView:0x10be1e090 )>",
    "<NSLayoutConstraint:0x1c0096bc0 _UIButtonBarStackView:0x10be1f620.trailing == _UIToolbarContentView:0x10be1e090.trailing   (active)>",
    "<NSLayoutConstraint:0x1c409d560 H:|-(8)-[_UIModernBarButton:0x10bd4faa0]   (active, names: '|':_UIButtonBarButton:0x10bd4f650 )>",
    "<NSLayoutConstraint:0x1c409d5b0 H:[_UIModernBarButton:0x10bd4faa0]-(>=8)-|   (active, names: '|':_UIButtonBarButton:0x10bd4f650 )>",
    "<NSLayoutConstraint:0x1c409dba0 H:|-(>=5)-[_UIModernBarButton:0x10bd51920]   (active, names: '|':_UIButtonBarButton:0x10bd512d0 )>",
    "<NSLayoutConstraint:0x1c409dbf0 H:[_UIModernBarButton:0x10bd51920]-(>=5)-|   (active, names: '|':_UIButtonBarButton:0x10bd512d0 )>",
    "<NSLayoutConstraint:0x1c409e690 H:|-(8)-[_UIModernBarButton:0x10bd52b30'Done']   (active, names: '|':_UIButtonBarButton:0x10bd51e40 )>",
    "<NSLayoutConstraint:0x1c409e6e0 H:[_UIModernBarButton:0x10bd52b30'Done']-(8)-|   (active, names: '|':_UIButtonBarButton:0x10bd51e40 )>",
    "<NSLayoutConstraint:0x1c0096ad0 'UISV-canvas-connection' UILayoutGuide:0x1c01be5a0'UIViewLayoutMarginsGuide'.leading == _UIButtonBarButton:0x10bd4f650.leading   (active)>",
    "<NSLayoutConstraint:0x1c0283930 'UISV-canvas-connection' UILayoutGuide:0x1c01be5a0'UIViewLayoutMarginsGuide'.trailing == _UIButtonBarButton:0x10bd51e40.trailing   (active)>",
    "<NSLayoutConstraint:0x1c0283980 'UISV-spacing' H:[_UIButtonBarButton:0x10bd4f650]-(0)-[UIView:0x10bd510f0]   (active)>",
    "<NSLayoutConstraint:0x1c02839d0 'UISV-spacing' H:[UIView:0x10bd510f0]-(0)-[_UIButtonBarButton:0x10bd512d0]   (active)>",
    "<NSLayoutConstraint:0x1c0283a20 'UISV-spacing' H:[_UIButtonBarButton:0x10bd512d0]-(0)-[UIView:0x10bd51c60]   (active)>",
    "<NSLayoutConstraint:0x1c0283a70 'UISV-spacing' H:[UIView:0x10bd51c60]-(0)-[_UIButtonBarButton:0x10bd51e40]   (active)>",
    "<NSLayoutConstraint:0x1c0284470 'UIView-Encapsulated-Layout-Width' UIToolbar:0x10be1dc50.width == 0   (active)>",
    "<NSLayoutConstraint:0x1c00969e0 'UIView-leftMargin-guide-constraint' H:|-(0)-[UILayoutGuide:0x1c01be5a0'UIViewLayoutMarginsGuide'](LTR)   (active, names: '|':_UIButtonBarStackView:0x10be1f620 )>",
    "<NSLayoutConstraint:0x1c0096a80 'UIView-rightMargin-guide-constraint' H:[UILayoutGuide:0x1c01be5a0'UIViewLayoutMarginsGuide']-(0)-|(LTR)   (active, names: '|':_UIButtonBarStackView:0x10be1f620 )>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x1c409d5b0 H:[_UIModernBarButton:0x10bd4faa0]-(>=8)-|   (active, names: '|':_UIButtonBarButton:0x10bd4f650 )>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2018-07-12 16:42:30.876255+0100 MyApp[3763:346405] [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:0x1c0284380 h=-&- v=-&- _UIToolbarContentView:0x10be1e090.width == UIToolbar:0x10be1dc50.width   (active)>",
    "<NSLayoutConstraint:0x1c0096b70 H:|-(8)-[_UIButtonBarStackView:0x10be1f620]   (active, names: '|':_UIToolbarContentView:0x10be1e090 )>",
    "<NSLayoutConstraint:0x1c0096bc0 _UIButtonBarStackView:0x10be1f620.trailing == _UIToolbarContentView:0x10be1e090.trailing   (active)>",
    "<NSLayoutConstraint:0x1c409dba0 H:|-(>=5)-[_UIModernBarButton:0x10bd51920]   (active, names: '|':_UIButtonBarButton:0x10bd512d0 )>",
    "<NSLayoutConstraint:0x1c409dbf0 H:[_UIModernBarButton:0x10bd51920]-(>=5)-|   (active, names: '|':_UIButtonBarButton:0x10bd512d0 )>",
    "<NSLayoutConstraint:0x1c409e690 H:|-(8)-[_UIModernBarButton:0x10bd52b30'Done']   (active, names: '|':_UIButtonBarButton:0x10bd51e40 )>",
    "<NSLayoutConstraint:0x1c409e6e0 H:[_UIModernBarButton:0x10bd52b30'Done']-(8)-|   (active, names: '|':_UIButtonBarButton:0x10bd51e40 )>",
    "<NSLayoutConstraint:0x1c0096ad0 'UISV-canvas-connection' UILayoutGuide:0x1c01be5a0'UIViewLayoutMarginsGuide'.leading == _UIButtonBarButton:0x10bd4f650.leading   (active)>",
    "<NSLayoutConstraint:0x1c0283930 'UISV-canvas-connection' UILayoutGuide:0x1c01be5a0'UIViewLayoutMarginsGuide'.trailing == _UIButtonBarButton:0x10bd51e40.trailing   (active)>",
    "<NSLayoutConstraint:0x1c0283980 'UISV-spacing' H:[_UIButtonBarButton:0x10bd4f650]-(0)-[UIView:0x10bd510f0]   (active)>",
    "<NSLayoutConstraint:0x1c02839d0 'UISV-spacing' H:[UIView:0x10bd510f0]-(0)-[_UIButtonBarButton:0x10bd512d0]   (active)>",
    "<NSLayoutConstraint:0x1c0283a20 'UISV-spacing' H:[_UIButtonBarButton:0x10bd512d0]-(0)-[UIView:0x10bd51c60]   (active)>",
    "<NSLayoutConstraint:0x1c0283a70 'UISV-spacing' H:[UIView:0x10bd51c60]-(0)-[_UIButtonBarButton:0x10bd51e40]   (active)>",
    "<NSLayoutConstraint:0x1c0284470 'UIView-Encapsulated-Layout-Width' UIToolbar:0x10be1dc50.width == 0   (active)>",
    "<NSLayoutConstraint:0x1c00969e0 'UIView-leftMargin-guide-constraint' H:|-(0)-[UILayoutGuide:0x1c01be5a0'UIViewLayoutMarginsGuide'](LTR)   (active, names: '|':_UIButtonBarStackView:0x10be1f620 )>",
    "<NSLayoutConstraint:0x1c0096a80 'UIView-rightMargin-guide-constraint' H:[UILayoutGuide:0x1c01be5a0'UIViewLayoutMarginsGuide']-(0)-|(LTR)   (active, names: '|':_UIButtonBarStackView:0x10be1f620 )>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x1c409dbf0 H:[_UIModernBarButton:0x10bd51920]-(>=5)-|   (active, names: '|':_UIButtonBarButton:0x10bd512d0 )>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2018-07-12 16:42:30.879831+0100 MyApp[3763:346405] [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:0x1c0284380 h=-&- v=-&- _UIToolbarContentView:0x10be1e090.width == UIToolbar:0x10be1dc50.width   (active)>",
    "<NSLayoutConstraint:0x1c0096b70 H:|-(8)-[_UIButtonBarStackView:0x10be1f620]   (active, names: '|':_UIToolbarContentView:0x10be1e090 )>",
    "<NSLayoutConstraint:0x1c0096bc0 _UIButtonBarStackView:0x10be1f620.trailing == _UIToolbarContentView:0x10be1e090.trailing   (active)>",
    "<NSLayoutConstraint:0x1c409e690 H:|-(8)-[_UIModernBarButton:0x10bd52b30'Done']   (active, names: '|':_UIButtonBarButton:0x10bd51e40 )>",
    "<NSLayoutConstraint:0x1c409e6e0 H:[_UIModernBarButton:0x10bd52b30'Done']-(8)-|   (active, names: '|':_UIButtonBarButton:0x10bd51e40 )>",
    "<NSLayoutConstraint:0x1c0096ad0 'UISV-canvas-connection' UILayoutGuide:0x1c01be5a0'UIViewLayoutMarginsGuide'.leading == _UIButtonBarButton:0x10bd4f650.leading   (active)>",
    "<NSLayoutConstraint:0x1c0283930 'UISV-canvas-connection' UILayoutGuide:0x1c01be5a0'UIViewLayoutMarginsGuide'.trailing == _UIButtonBarButton:0x10bd51e40.trailing   (active)>",
    "<NSLayoutConstraint:0x1c0283980 'UISV-spacing' H:[_UIButtonBarButton:0x10bd4f650]-(0)-[UIView:0x10bd510f0]   (active)>",
    "<NSLayoutConstraint:0x1c02839d0 'UISV-spacing' H:[UIView:0x10bd510f0]-(0)-[_UIButtonBarButton:0x10bd512d0]   (active)>",
    "<NSLayoutConstraint:0x1c0283a20 'UISV-spacing' H:[_UIButtonBarButton:0x10bd512d0]-(0)-[UIView:0x10bd51c60]   (active)>",
    "<NSLayoutConstraint:0x1c0283a70 'UISV-spacing' H:[UIView:0x10bd51c60]-(0)-[_UIButtonBarButton:0x10bd51e40]   (active)>",
    "<NSLayoutConstraint:0x1c0284470 'UIView-Encapsulated-Layout-Width' UIToolbar:0x10be1dc50.width == 0   (active)>",
    "<NSLayoutConstraint:0x1c00969e0 'UIView-leftMargin-guide-constraint' H:|-(0)-[UILayoutGuide:0x1c01be5a0'UIViewLayoutMarginsGuide'](LTR)   (active, names: '|':_UIButtonBarStackView:0x10be1f620 )>",
    "<NSLayoutConstraint:0x1c0096a80 'UIView-rightMargin-guide-constraint' H:[UILayoutGuide:0x1c01be5a0'UIViewLayoutMarginsGuide']-(0)-|(LTR)   (active, names: '|':_UIButtonBarStackView:0x10be1f620 )>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x1c409e6e0 H:[_UIModernBarButton:0x10bd52b30'Done']-(8)-|   (active, names: '|':_UIButtonBarButton:0x10bd51e40 )>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2018-07-12 16:42:30.881915+0100 MyApp[3763:346405] [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:0x1c0284380 h=-&- v=-&- _UIToolbarContentView:0x10be1e090.width == UIToolbar:0x10be1dc50.width   (active)>",
    "<NSLayoutConstraint:0x1c0096b70 H:|-(8)-[_UIButtonBarStackView:0x10be1f620]   (active, names: '|':_UIToolbarContentView:0x10be1e090 )>",
    "<NSLayoutConstraint:0x1c0096bc0 _UIButtonBarStackView:0x10be1f620.trailing == _UIToolbarContentView:0x10be1e090.trailing   (active)>",
    "<NSLayoutConstraint:0x1c0096ad0 'UISV-canvas-connection' UILayoutGuide:0x1c01be5a0'UIViewLayoutMarginsGuide'.leading == _UIButtonBarButton:0x10bd4f650.leading   (active)>",
    "<NSLayoutConstraint:0x1c0283930 'UISV-canvas-connection' UILayoutGuide:0x1c01be5a0'UIViewLayoutMarginsGuide'.trailing == _UIButtonBarButton:0x10bd51e40.trailing   (active)>",
    "<NSLayoutConstraint:0x1c0283980 'UISV-spacing' H:[_UIButtonBarButton:0x10bd4f650]-(0)-[UIView:0x10bd510f0]   (active)>",
    "<NSLayoutConstraint:0x1c02839d0 'UISV-spacing' H:[UIView:0x10bd510f0]-(0)-[_UIButtonBarButton:0x10bd512d0]   (active)>",
    "<NSLayoutConstraint:0x1c0283a20 'UISV-spacing' H:[_UIButtonBarButton:0x10bd512d0]-(0)-[UIView:0x10bd51c60]   (active)>",
    "<NSLayoutConstraint:0x1c0283a70 'UISV-spacing' H:[UIView:0x10bd51c60]-(0)-[_UIButtonBarButton:0x10bd51e40]   (active)>",
    "<NSLayoutConstraint:0x1c0284470 'UIView-Encapsulated-Layout-Width' UIToolbar:0x10be1dc50.width == 0   (active)>",
    "<NSLayoutConstraint:0x1c00969e0 'UIView-leftMargin-guide-constraint' H:|-(0)-[UILayoutGuide:0x1c01be5a0'UIViewLayoutMarginsGuide'](LTR)   (active, names: '|':_UIButtonBarStackView:0x10be1f620 )>",
    "<NSLayoutConstraint:0x1c0096a80 'UIView-rightMargin-guide-constraint' H:[UILayoutGuide:0x1c01be5a0'UIViewLayoutMarginsGuide']-(0)-|(LTR)   (active, names: '|':_UIButtonBarStackView:0x10be1f620 )>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x1c0283a70 'UISV-spacing' H:[UIView:0x10bd51c60]-(0)-[_UIButtonBarButton:0x10bd51e40]   (active)>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2018-07-12 16:42:30.882524+0100 MyApp[3763:346405] [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:0x1c0284380 h=-&- v=-&- _UIToolbarContentView:0x10be1e090.width == UIToolbar:0x10be1dc50.width   (active)>",
    "<NSLayoutConstraint:0x1c0096b70 H:|-(8)-[_UIButtonBarStackView:0x10be1f620]   (active, names: '|':_UIToolbarContentView:0x10be1e090 )>",
    "<NSLayoutConstraint:0x1c0096bc0 _UIButtonBarStackView:0x10be1f620.trailing == _UIToolbarContentView:0x10be1e090.trailing   (active)>",
    "<NSLayoutConstraint:0x1c0284470 'UIView-Encapsulated-Layout-Width' UIToolbar:0x10be1dc50.width == 0   (active)>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x1c0096bc0 _UIButtonBarStackView:0x10be1f620.trailing == _UIToolbarContentView:0x10be1e090.trailing   (active)>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
Steve Brooker
  • 1,043
  • 11
  • 28

1 Answers1

2

The UIButtonBars are used to create custom keyboard shortcuts and are managed by UITextInputAssistantItem which is called when a "Text Field" becomes First Responder. To prevent the conflicting constrains messages you can initialise the ButtonGroups. When I have a number of textFields I create an outlet collection and add each textField to the collection. Then in ViewDidLoad I run the following code:

        for textField in TextFields{
          // Set BarButtonGroups to avoid layout constraint errors
          textField.inputAssistantItem.leadingBarButtonGroups = []
          textField.inputAssistantItem.trailingBarButtonGroups = []
        }
Byron
  • 31
  • 1
  • 4
  • 1
    Byron. Thanks. However I only have one UI component UIWebView. I do not have any TextFields that I could set values on. I expect that internally UIWebView dynamically creates TextFields and other components to interact with the user via the keyboard when the HTML requires it, so I expect this is an internal Apple problem that I cannot do anything about. Thankfully, it does not stop my app doing anything, nor so far has it stopped it being approved for sale. – Steve Brooker Jan 17 '19 at 19:13
  • Hi Steve. Thanks for the reply. I guess that dynamically created textFields could indeed be responsible for the issue. So, as you say, It does look like an emulation problem that you cannot do anything about :-(. – Byron Jan 19 '19 at 11:13