Strange UIButtonBarButton layout errors on all textView, fields and searchbars on iPad only

All of a sudden, all TextViews, TextFields and even searchbars give the same console error on entering them:

Code Block
(
  "<NSAutoresizingMaskLayoutConstraint:0x281fe1b30 h=--& v=--& _UIButtonBarButton:0x1290c0cd0.height == 0  (active)>",
  "<NSLayoutConstraint:0x281ffa440 V:|-(6)-[_UIUCBKBSelectionBackground:0x1290c14c0]  (active, names: '|':_UIButtonBarButton:0x1290c0cd0 )>",
  "<NSLayoutConstraint:0x281ffa3a0 _UIUCBKBSelectionBackground:0x1290c14c0.bottom == _UIButtonBarButton:0x1290c0cd0.bottom - 6  (active)>"
)

Happens on iPads only (simulator too). My app is a universal app, programmatic UI (UIKit). iPhones are perfectly fine. Happened all of a sudden two days ago. Could this be because of upgrades to 14.2 both simulator and devices and relevant Xcode updates? I have no clue whatsoever where this comes from and how to remove it ...

EDIT
Starting to think this has something to do with the keyboards on iPads?

Replies

Anyone?
I have the exact same problem.
I'm having the same problem. It happens when the iPad keyboard appears. If I find a solution then I'll post it here...
@DeveloperSammy Share DeveloperSammy question
You updated to 14.2 coming from which version of iPadOS ?

Is this a layout warning ? if so
  • What is the complete warning message ? Incompatible constraints ?

  • Have you set constraints yourself that relate to any of the mentioned objects ?

  • Does it have any bad consequence on display ?

Same. Bloody annoying since it spams the debug log, but at least it doesn't seem to have a visible manifestation in the UI.
@Claude31

Coming from iOS14/iPadOS14.
The provided error message is the complete message. Like others mention above, it has to do with the keyboard appearing.

It has nothing to do with self set constraints. In fact, it happens without even a ButtonBar (or ButtonBarButtons) present!

App works normally, so the user does not experience any of it!
Code Block
// Workaround to remove autolayout errors when keyboard shows on iPad.
// <NSAutoresizingMaskLayoutConstraint:0x28376afd0 h=--& v=--& _UIButtonBarButton:0x107f0ce30.height == 0   (active)>
// Introduced approx iOS 14.2 according to https://developer.apple.com/forums/thread/667441
// Side effect: Removes the redo/undo and paste buttons from the keyboard
let item = textField.inputAssistantItem
item.leadingBarButtonGroups = []
item.trailingBarButtonGroups = []

I'm having the same issue on below with Xcode 12.4:
  • Simulator (iPad Air 4th generation) - iOS 14.4

  • Device (iPad Air 2) - iOS 14.4.2

As one of work arounds, I found the console messages stop when I disable below of iPad Settings.
  • Settings > General > Keyboards > All Keyboards > Shortcuts

It applied both on the simulator and my iPad Air 2 device.
Not sure the side effect yet.
  • I did manage to resolve the navigation constraint alarm using this method, but the cut, copy and paste function on my iPad keyboard didn't work. I don't know if there's a better way.

Add a Comment
The workaround suggested by Martix fixed the constraint errors in my case. However, it does not fix a related issue I am having. After engaging the searchbar, when I return to the previous controller (via pop) from the current one (which has the searchbar), the autolayout constraints used on the overlay panel there get messed up... so some major mess-up is being done by the searchbar once user engages it. The problem does not happen if I pop back without engaging the searchbar.

Another issue - I am unable to hide the navigation bar in ViewWillDisappear() once the user engages the searchbar. If the user does not engage the searchbar, then the navbar hides on command.

This problem shows up on my ipad version only. I am using a couple of viewcontrollers within a navigation controller. I set the search controller as a navitem:

navigationItem.searchController = searchController

I tried setting the searchcontroller into the tableHeaderView - but same problem there too...
  • Solved my autolayout issue - it is unrelated to the searchbar. However, the navbar not disappearing once keyboard is engaged still persists.

Add a Comment