概要
iOS14.2以降のiPadでUITextFieldをフォーカスすると、以下の警告がログ出力されます。iOS 14.1以前のiPadでは発生しないのでおそらくOSのバグでしょう。
2021-02-11 16:22:34.675060+0900 UITextField Test[4986:357247] [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:0x60000072d8b0 h=--& v=--& _UIButtonBarButton:0x7fd672506e80.height == 0 (active)>",
"<NSLayoutConstraint:0x60000075b840 _UIUCBKBSelectionBackground:0x7fd67250e6c0.bottom == _UIButtonBarButton:0x7fd672506e80.bottom - 6 (active)>",
"<NSLayoutConstraint:0x60000075b7a0 V:|-(6)-[_UIUCBKBSelectionBackground:0x7fd67250e6c0] (active, names: '|':_UIButtonBarButton:0x7fd672506e80 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x60000075b840 _UIUCBKBSelectionBackground:0x7fd67250e6c0.bottom == _UIButtonBarButton:0x7fd672506e80.bottom - 6 (active)>
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.
2021-02-11 16:22:34.675483+0900 UITextField Test[4986:357247] [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:0x60000072dc20 h=--& v=--& _UIButtonBarButton:0x7fd67250e840.height == 0 (active)>",
"<NSLayoutConstraint:0x60000075bb10 _UIUCBKBSelectionBackground:0x7fd67250f150.bottom == _UIButtonBarButton:0x7fd67250e840.bottom - 6 (active)>",
"<NSLayoutConstraint:0x60000075ba70 V:|-(6)-[_UIUCBKBSelectionBackground:0x7fd67250f150] (active, names: '|':_UIButtonBarButton:0x7fd67250e840 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x60000075bb10 _UIUCBKBSelectionBackground:0x7fd67250f150.bottom == _UIButtonBarButton:0x7fd67250e840.bottom - 6 (active)>
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.
2021-02-11 16:22:34.685123+0900 UITextField Test[4986:357247] [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:0x60000072d540 h=--& v=--& _UIButtonBarButton:0x7fd672506cc0.height == 0 (active)>",
"<NSLayoutConstraint:0x60000075ada0 V:|-(6)-[_UIUCBKBSelectionBackground:0x7fd67250ddf0] (active, names: '|':_UIButtonBarButton:0x7fd672506cc0 )>",
"<NSLayoutConstraint:0x60000075ad00 _UIUCBKBSelectionBackground:0x7fd67250ddf0.bottom == _UIButtonBarButton:0x7fd672506cc0.bottom - 6 (active)>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x60000075ad00 _UIUCBKBSelectionBackground:0x7fd67250ddf0.bottom == _UIButtonBarButton:0x7fd672506cc0.bottom - 6 (active)>
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.
2021-02-11 16:22:34.687963+0900 UITextField Test[4986:357247] [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:0x60000072f2a0 h=--& v=--& _UIButtonBarButton:0x7fd66241b560.height == 0 (active)>",
"<NSLayoutConstraint:0x60000072ea80 _UIUCBKBSelectionBackground:0x7fd66241c260.bottom == _UIButtonBarButton:0x7fd66241b560.bottom - 6 (active)>",
"<NSLayoutConstraint:0x60000072e9e0 V:|-(6)-[_UIUCBKBSelectionBackground:0x7fd66241c260] (active, names: '|':_UIButtonBarButton:0x7fd66241b560 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x60000072ea80 _UIUCBKBSelectionBackground:0x7fd66241c260.bottom == _UIButtonBarButton:0x7fd66241b560.bottom - 6 (active)>
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.
2021-02-11 16:22:34.688425+0900 UITextField Test[4986:357247] [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:0x60000072f610 h=--& v=--& _UIButtonBarButton:0x7fd66241c3e0.height == 0 (active)>",
"<NSLayoutConstraint:0x60000072ed50 _UIUCBKBSelectionBackground:0x7fd66241d1f0.bottom == _UIButtonBarButton:0x7fd66241c3e0.bottom - 6 (active)>",
"<NSLayoutConstraint:0x60000072ecb0 V:|-(6)-[_UIUCBKBSelectionBackground:0x7fd66241d1f0] (active, names: '|':_UIButtonBarButton:0x7fd66241c3e0 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x60000072ed50 _UIUCBKBSelectionBackground:0x7fd66241d1f0.bottom == _UIButtonBarButton:0x7fd66241c3e0.bottom - 6 (active)>
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.
2021-02-11 16:22:34.688888+0900 UITextField Test[4986:357247] [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:0x60000072ef30 h=--& v=--& _UIButtonBarButton:0x7fd6624199e0.height == 0 (active)>",
"<NSLayoutConstraint:0x60000072e710 V:|-(6)-[_UIUCBKBSelectionBackground:0x7fd66241b3e0] (active, names: '|':_UIButtonBarButton:0x7fd6624199e0 )>",
"<NSLayoutConstraint:0x60000072e7b0 _UIUCBKBSelectionBackground:0x7fd66241b3e0.bottom == _UIButtonBarButton:0x7fd6624199e0.bottom - 6 (active)>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x60000072e7b0 _UIUCBKBSelectionBackground:0x7fd66241b3e0.bottom == _UIButtonBarButton:0x7fd6624199e0.bottom - 6 (active)>
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.
対象OS
以下のOSでの発生をシミュレータ上で確認しています。iPhoneでは発生しませんでした。
- iOS 14.2
- iOS 14.3
- iOS 14.4
検証アプリ
以下のように、適当にUITextFieldを配置したアプリを作ります。ViewControllerなどのプログラムはデフォルトのままです。もちろんこの時点ではLayoutContraintsの警告は出ていません。
iOS 14.2のiPadシミュレータ上で実行し、UITextFieldをフォーカスすると件のログが出力されます。
当然NavigationControllerは使っていないのですが、問題の制約の中に_UIButtonBarButton
がいるのが謎ですね。
関連記事
Apple Developer Forumsでも同様の報告がありました。
- Strange UIButtonBarButton layout errors on all textView, fields and searchbars on iPad only | Apple Developer Forums - https://developer.apple.com/forums/thread/667441