【问题标题】:Flutter - TextFormField - Unable to simultaneously satisfy constraints (NSAutoresizingMaskLayoutConstraint)Flutter - TextFormField - 无法同时满足约束(NSAutoresizingMaskLayoutConstraint)
【发布时间】:2021-06-12 00:02:00
【问题描述】:

使用Flutter Channel stable, 2.0.1,在iPad 物理设备iOS 14.4 上,每次点击任何TextFormField 时都会收到以下控制台消息。

[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:0x281871540 h=--& v=--& _UIButtonBarButton:0x109a86990.height == 0   (active)>",
    "<NSLayoutConstraint:0x28185d950 _UIUCBKBSelectionBackground:0x109b2ddf0.bottom == _UIButtonBarButton:0x109a86990.bottom - 6   (active)>",
    "<NSLayoutConstraint:0x28185d770 V:|-(6)-[_UIUCBKBSelectionBackground:0x109b2ddf0]   (active, names: '|':_UIButtonBarButton:0x109a86990 )>"
)


Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x28185d950 _UIUCBKBSelectionBackground:0x109b2ddf0.bottom == _UIButtonBarButton:0x109a86990.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.
[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:0x281870e10 h=--& v=--& _UIButtonBarButton:0x11c9411b0.height == 0   (active)>",
    "<NSLayoutConstraint:0x2818705f0 _UIUCBKBSelectionBackground:0x109c5a3b0.bottom == _UIButtonBarButton:0x11c9411b0.bottom - 6   (active)>",
    "<NSLayoutConstraint:0x281871130 V:|-(6)-[_UIUCBKBSelectionBackground:0x109c5a3b0]   (active, names: '|':_UIButtonBarButton:0x11c9411b0 )>"
)


Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x2818705f0 _UIUCBKBSelectionBackground:0x109c5a3b0.bottom == _UIButtonBarButton:0x11c9411b0.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.
[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:0x281873ca0 h=--& v=--& _UIButtonBarButton:0x109ca0d90.height == 0   (active)>",
    "<NSLayoutConstraint:0x281871040 V:|-(6)-[_UIUCBKBSelectionBackground:0x109ca0f60]   (active, names: '|':_UIButtonBarButton:0x109ca0d90 )>",
    "<NSLayoutConstraint:0x2818714a0 _UIUCBKBSelectionBackground:0x109ca0f60.bottom == _UIButtonBarButton:0x109ca0d90.bottom - 6   (active)>"
)


Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x2818714a0 _UIUCBKBSelectionBackground:0x109ca0f60.bottom == _UIButtonBarButton:0x109ca0d90.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.
[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:0x2818702d0 h=--& v=--& _UIButtonBarButton:0x126929f40.height == 0   (active)>",
    "<NSLayoutConstraint:0x28185f9d0 V:|-(6)-[_UIUCBKBSelectionBackground:0x12692af20]   (active, names: '|':_UIButtonBarButton:0x126929f40 )>",
    "<NSLayoutConstraint:0x28185f700 _UIUCBKBSelectionBackground:0x12692af20.bottom == _UIButtonBarButton:0x126929f40.bottom - 6   (active)>"
)


Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x28185f700 _UIUCBKBSelectionBackground:0x12692af20.bottom == _UIButtonBarButton:0x126929f40.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.
[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:0x281851590 h=--& v=--& _UIButtonBarButton:0x109c45d70.height == 0   (active)>",
    "<NSLayoutConstraint:0x281850c30 V:|-(6)-[_UIUCBKBSelectionBackground:0x109c56fb0]   (active, names: '|':_UIButtonBarButton:0x109c45d70 )>",
    "<NSLayoutConstraint:0x281850cd0 _UIUCBKBSelectionBackground:0x109c56fb0.bottom == _UIButtonBarButton:0x109c45d70.bottom - 6   (active)>"
)


Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x281850cd0 _UIUCBKBSelectionBackground:0x109c56fb0.bottom == _UIButtonBarButton:0x109c45d70.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.
[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:0x281851a40 h=--& v=--& _UIButtonBarButton:0x109c8f2a0.height == 0   (active)>",
    "<NSLayoutConstraint:0x281850f00 V:|-(6)-[_UIUCBKBSelectionBackground:0x109c567b0]   (active, names: '|':_UIButtonBarButton:0x109c8f2a0 )>",
    "<NSLayoutConstraint:0x281850fa0 _UIUCBKBSelectionBackground:0x109c567b0.bottom == _UIButtonBarButton:0x109c8f2a0.bottom - 6   (active)>"
)


Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x281850fa0 _UIUCBKBSelectionBackground:0x109c567b0.bottom == _UIButtonBarButton:0x109c8f2a0.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.
[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:0x281852710 h=--& v=--& _UIButtonBarButton:0x109c3c760.height == 0   (active)>",
    "<NSLayoutConstraint:0x281851e00 V:|-(6)-[_UIUCBKBSelectionBackground:0x109c3cde0]   (active, names: '|':_UIButtonBarButton:0x109c3c760 )>",
    "<NSLayoutConstraint:0x281851ea0 _UIUCBKBSelectionBackground:0x109c3cde0.bottom == _UIButtonBarButton:0x109c3c760.bottom - 6   (active)>"
)


Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x281851ea0 _UIUCBKBSelectionBackground:0x109c3cde0.bottom == _UIButtonBarButton:0x109c3c760.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.
[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:0x28185c1e0 h=--& v=--& _UIButtonBarButton:0x109c3cf60.height == 0   (active)>",
    "<NSLayoutConstraint:0x2818520d0 V:|-(6)-[_UIUCBKBSelectionBackground:0x109ca5eb0]   (active, names: '|':_UIButtonBarButton:0x109c3cf60 )>",
    "<NSLayoutConstraint:0x281852170 _UIUCBKBSelectionBackground:0x109ca5eb0.bottom == _UIButtonBarButton:0x109c3cf60.bottom - 6   (active)>"
)


Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x281852170 _UIUCBKBSelectionBackground:0x109ca5eb0.bottom == _UIButtonBarButton:0x109c3cf60.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.

Textfield 上的 onTap 只是将焦点赋予该字段 - 键盘出现 - 但不会改变视图上的任何内容。

我了解到,对于某些人来说,这条消息可以忽略,但对于某些人来说,应用程序更新已被 Apple 拒绝。

我们如何解决这个约束问题?

【问题讨论】:

  • 更新到flutter 2 stable后我也有同样的错误
  • 当屏幕键盘显示和某些设备上时,我在模拟器上遇到了同样的问题。
  • 这里也一样,有人找到解决办法了吗?

标签: ios flutter ipad textformfield


【解决方案1】:

在 Form() 小部件中使用 key 属性时似乎是一个错误。 GlobalKey&lt;FormState&gt;()

也可能是您的 Container/Widget 与键盘发生冲突。如果导致不稳定的行为,IOS 会打破屏幕对象的约束。

尝试移除您的 Container(高度和宽度)限制。这对我有用。

【讨论】:

猜你喜欢
  • 1970-01-01
  • 2012-12-28
  • 1970-01-01
  • 2014-10-27
  • 2014-06-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多