SwiftUi无法同时满足约束-当文本字段和键盘的焦点打开时
当我打开带有textfield的工作表时,我将焦点放在textfield上,然后出现键盘并显示以下消息:SwiftUi无法同时满足约束-当文本字段和键盘的焦点打开时,swiftui,uibarbuttonitem,Swiftui,Uibarbuttonitem,当我打开带有textfield的工作表时,我将焦点放在textfield上,然后出现键盘并显示以下消息: 2021-02-06 22:29:35.817858+0100 OrientationEPS[4026:269878] [LayoutConstraints] Unable to simultaneously satisfy constraints. Probably at least one of the constraints in the following list is one
2021-02-06 22:29:35.817858+0100 OrientationEPS[4026:269878] [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:0x6000030b3250 h=--& v=--& _UIButtonBarButton:0x7fea6492cf40.height == 0 (active)>",
"<NSLayoutConstraint:0x6000030fce60 _UIUCBKBSelectionBackground:0x7fea64930c50.bottom == _UIButtonBarButton:0x7fea6492cf40.bottom - 6 (active)>",
"<NSLayoutConstraint:0x6000030ec7d0 V:|-(6)-[_UIUCBKBSelectionBackground:0x7fea64930c50] (active, names: '|':_UIButtonBarButton:0x7fea6492cf40 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x6000030fce60 _UIUCBKBSelectionBackground:0x7fea64930c50.bottom == _UIButtonBarButton:0x7fea6492cf40.bottom - 6 (active)>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
2021-02-06 22:29:35.817858+0100定向PS[4026:269878][LayoutConstraints]无法同时满足约束。
可能下面列表中至少有一个约束是您不想要的。
试试这个:
(1) 看看每一个约束,试着找出你不期望的;
(2) 找到添加了不需要的约束的代码,然后修复它。
(注意:如果您看到不理解的NSAutoresizingMaskLayoutConstraints,请参阅UIView属性TranslatesAutoResizingMaskToConstraints的文档)
(
"",
"",
""
)
将尝试通过打破约束进行恢复
在UIViewAlertForUnsatifiableConstraints处创建一个符号断点,以便在调试器中捕获该断点。
我真的不明白绿色部分是怎么说的。。。(NSAutoresizingMaskLayoutConstraint-NSLayoutConstraint)
你能给我解释一下这个消息吗?
我可以添加我的代码,但我不知道我必须发布哪部分
此错误消息显示在所有以textfield为焦点的工作表上。(在我的应用程序中为3)
我的应用程序的屏幕截图。
在升级到12.4之后,我才开始注意到这一点(尽管我以前可能没有注意到)。经过大量调查,我发现每当UITextField激活时,我都会收到相同的消息
要确认这一点,只需制作一个只有一个UITextField的简单应用程序,不管约束设置与否,都会出现相同的警告。SwiftUI已知会在日志中导致类似这样的无害错误。如果你实际上没有遇到问题,我会说忽略它是相当安全的。