在不关闭键盘的情况下在文本字段之间切换时 Xcode 约束中断 [英] Xcode Constraint Break When Switching Between Text Fields Without Dismissing Keyboard

查看:81
本文介绍了在不关闭键盘的情况下在文本字段之间切换时 Xcode 约束中断的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几天来我一直在与 Xcode 中的一个问题作斗争,但我不知道出了什么问题.我创建了一个简单的 UIViewcontroller 与三个单独的文本字段.当我在模拟器或物理设备上运行应用程序时,当我点击文本字段时,我会在控制台中收到此警告.只有当我点击下一个文本字段而不先关闭键盘时才会发生这种情况.如果我在每次输入文本字段后关闭键盘,则不会有调试控制台投诉.但是当我不这样做时,控制台会在点击下一个文本字段时返回以下内容.

I've been battling an issue in Xcode for a couple of days now and I can't figure out what's wrong. I've created a simple UIViewcontroller with three separate Textfields. When I run the app in the simulator or on a physical device, I get this warning in the console when I tap on the textfields. It happens only when I tap on the next textfield without dismissing the keyboard first. If I dismiss the keyboard after every textfield input, there are no debug console complaints. But when I don't the console returns the following on tapping the next textfield.

"[LayoutConstraints] 无法同时满足约束.可能以下列表中的至少一项约束是您不想要的.尝试这个:(1) 查看每个约束并尝试找出您不期望的;(2) 找到添加不需要的约束或约束的代码并修复它.

"[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:0x281f15bd0 'assistantHeight' TUISystemInputAssistantView:0x14602a340.height == 55   (active)>",
"<NSLayoutConstraint:0x281f2de00 'assistantView.bottom' TUISystemInputAssistantView:0x14602a340.bottom == _UIKBCompatInputView:0x1460631d0.top   (active)>",
"<NSLayoutConstraint:0x281f2fcf0 'assistantView.top' V:|-(0)-[TUISystemInputAssistantView:0x14602a340]   (active, names: '|':UIInputSetHostView:0x143e5cd50 )>",
"<NSLayoutConstraint:0x281f17200 'inputView.top' V:|-(0)-[_UIKBCompatInputView:0x1460631d0]   (active, names: '|':UIInputSetHostView:0x143e5cd50 )>"

将尝试通过打破约束来恢复在 UIViewAlertForUnsatisfiableConstraints 处创建一个符号断点以在调试器中捕获它.中列出的 UIView 上的 UIConstraintBasedLayoutDebugging 类别中的方法也可能会有所帮助."

Will attempt to recover by breaking constraint Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger. The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in may also be helpful."

我创建了一个新的、干净的 UIViewcontroller,里面什么都没有,只有三个简单的文本字段,但我仍然遇到这个问题.我这样做了,因为在我的原始项目中,我将文本字段排列在堆栈视图中,并认为这可能会导致问题,但显然不是.

I have created a new, clean UIViewcontroller with nothing inside, just three simple textfields and I still experience this issue. I've done this, because in my original project, I had the textfields arranged inside a stackview and thought that might be causing the issue, but it clearly isn't.

有人遇到过这个问题吗?

Has anyone encountered this issue?

非常感谢您的时间和任何帮助!

Thanks very much for your time and any help!

推荐答案

布局约束错误消息与您的布局无关.

The layout constraint error message has nothing to do with your layout.

这是输入助手视图的内部问题(可以被视为错误) - 键盘上方显示的自动完成选项.

It's an internal issue (could be considered a bug) with the Input Assistant View - the auto-complete options shown above the keyboard.

如果您使用Debug View Hierarchy,您可以找到错误消息中列出的罪魁祸首:TUISystemInputAssistantView

If you use Debug View Hierarchy you can find the culprit listed in the error message: TUISystemInputAssistantView

您可以忽略此错误/警告消息,因为它不受您的控制.

You can ignore this error / warning message, as it is out of your hands.

编辑

错误/警告消息显示:

"<NSLayoutConstraint:0x281f15bd0 'assistantHeight' TUISystemInputAssistantView:0x14602a340.height == 55   (active)>",

以下是您可以使用 Debug View Hierarchy 找到的内容:

Here is what you can find using Debug View Hierarchy:

如您所见,违规元素"是 TUISystemInputAssistantView,它是 iOS 内部功能的一部分.

As you can see, the "offending element" is the TUISystemInputAssistantView which is part of iOS internal functionality.

这篇关于在不关闭键盘的情况下在文本字段之间切换时 Xcode 约束中断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆