Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swapping through UITextFields constraint issue

I have an EditProfileViewController, with a tableview and textfields. In one of the textfields I have a pickerView as inputView and a toolBar in the inputAccessoryView. When the view loads and I select the firstName textfield, and return and move on to the lastName textfield, I get a constraint warning.

[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. 
(
"<NSLayoutConstraint:0x2809a4640 'assistantHeight' TUISystemInputAssistantView:0x1113b11a0.height == 45   (active)>",
"<NSLayoutConstraint:0x2809a0320 'assistantView.bottom' TUISystemInputAssistantView:0x1113b11a0.bottom == _UIKBCompatInputView:0x11a437e80.top   (active)>",
"<NSLayoutConstraint:0x2809a05a0 'assistantView.top' V:|-(0)-[TUISystemInputAssistantView:0x1113b11a0]   (active, names: '|':UIInputSetHostView:0x11d06ce50 )>",
"<NSLayoutConstraint:0x280943840 'inputView.top' V:|-(0)-[_UIKBCompatInputView:0x11a437e80]   (active, names: '|':UIInputSetHostView:0x11d06ce50 )>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x2809a0320 'assistantView.bottom' TUISystemInputAssistantView:0x1113b11a0.bottom == _UIKBCompatInputView:0x11a437e80.top   (active)>

When I switch between two default textfields this happens, and I don't understand why. I did some research and from what I can see this is a bug with iOS 13, since on another device with iOS 10, this does not happened.

The workaround to remove this constraint issue is to set the autoCorrectionType = false. But I would like to have this enabled. I think this happens because I have a pickerView in the inputView of the countryTextfield, but I don't know how to solve this.

like image 559
Wolfgang Avatar asked Apr 17 '26 16:04

Wolfgang


1 Answers

This started happening in my app with iOS13 and I suspect it's a bug. After trying everything I could think of, I switched off autocorrection and stopped getting constraint issues.

textEdit.autocorrectionType = .no
like image 58
Golompse Avatar answered Apr 19 '26 06:04

Golompse



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!