Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios Swift 3/WKWebView-单击表单中的输入时如何获取有效约束?_Ios_Swift_Wkwebview - Fatal编程技术网

Ios Swift 3/WKWebView-单击表单中的输入时如何获取有效约束?

Ios Swift 3/WKWebView-单击表单中的输入时如何获取有效约束?,ios,swift,wkwebview,Ios,Swift,Wkwebview,我有以下代码: override func loadView() { super.loadView() let webConfiguration = WKWebViewConfiguration() webView = WKWebView(frame: .zero, configuration: webConfiguration) webView.navigationDelegate = self view = webView } override fu

我有以下代码:

override func loadView() {
    super.loadView()
    let webConfiguration = WKWebViewConfiguration()
    webView = WKWebView(frame: .zero, configuration: webConfiguration)
    webView.navigationDelegate = self
    view = webView
}

override func viewDidLoad() {
    super.viewDidLoad()
    let myURL = URL(string: "https://www.w3schools.com/html/html_forms.asp")
    let myRequest = URLRequest(url: myURL!)
    webView.load(myRequest)
}
但当我运行它时,只要我点击表单中的某个输入来键入某个内容,键盘就会弹出,从而推高整个视图。控制台显示以下内容:

[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:0x1c42894c0 h=-&- v=-&- UIToolbar:0x125d24040.width == _UIInputViewContent:0x125d232c0.width   (active)>",
    "<NSAutoresizingMaskLayoutConstraint:0x1c4289600 h=--& v=--& _UIInputViewContent:0x125d232c0.width == 0   (active)>",
    "<NSLayoutConstraint:0x1c4281360 H:|-(0)-[_UIButtonBarStackView:0x125e10970]   (active, names: '|':_UIToolbarContentView:0x125d24480 )>",
    "<NSLayoutConstraint:0x1c42813b0 _UIButtonBarStackView:0x125e10970.trailing == _UIToolbarContentView:0x125d24480.trailing + 8   (active)>",
    "<NSLayoutConstraint:0x1c0282df0 _UIToolbarContentView:0x125d24480.trailing == UIToolbar:0x125d24040.trailing   (active)>",
    "<NSLayoutConstraint:0x1c0282e90 H:|-(0)-[_UIToolbarContentView:0x125d24480]   (active, names: '|':UIToolbar:0x125d24040 )>",
    "<NSLayoutConstraint:0x1c4288980 H:|-(>=5)-[_UIModernBarButton:0x125e33a00]   (active, names: '|':_UIButtonBarButton:0x125e333b0 )>",
    "<NSLayoutConstraint:0x1c42889d0 H:[_UIModernBarButton:0x125e33a00]-(>=5)-|   (active, names: '|':_UIButtonBarButton:0x125e333b0 )>",
    "<NSLayoutConstraint:0x1c028d5c0 H:|-(8)-[_UIModernBarButton:0x125d4fa20'Done']   (active, names: '|':_UIButtonBarButton:0x125e34320 )>",
    "<NSLayoutConstraint:0x1c028d610 H:[_UIModernBarButton:0x125d4fa20'Done']-(0)-|   (active, names: '|':_UIButtonBarButton:0x125e34320 )>",
    "<NSLayoutConstraint:0x1c028d9d0 'UISV-canvas-connection' UILayoutGuide:0x1c41b88e0'UIViewLayoutMarginsGuide'.leading == _UIButtonBarButton:0x125e31e70.leading   (active)>",
    "<NSLayoutConstraint:0x1c028db10 'UISV-canvas-connection' UILayoutGuide:0x1c41b88e0'UIViewLayoutMarginsGuide'.trailing == _UIButtonBarButton:0x125e34320.trailing   (active)>",
    "<NSLayoutConstraint:0x1c028db60 'UISV-spacing' H:[_UIButtonBarButton:0x125e31e70]-(0)-[UIView:0x125e331d0]   (active)>",
    "<NSLayoutConstraint:0x1c028dbb0 'UISV-spacing' H:[UIView:0x125e331d0]-(0)-[_UIButtonBarButton:0x125e333b0]   (active)>",
    "<NSLayoutConstraint:0x1c028dc00 'UISV-spacing' H:[_UIButtonBarButton:0x125e333b0]-(0)-[UIView:0x125e34140]   (active)>",
    "<NSLayoutConstraint:0x1c028dc50 'UISV-spacing' H:[UIView:0x125e34140]-(0)-[_UIButtonBarButton:0x125e34320]   (active)>",
    "<NSLayoutConstraint:0x1c409e1e0 'UIView-leftMargin-guide-constraint' H:|-(0)-[UILayoutGuide:0x1c41b88e0'UIViewLayoutMarginsGuide'](LTR)   (active, names: '|':_UIButtonBarStackView:0x125e10970 )>",
    "<NSLayoutConstraint:0x1c4281130 'UIView-rightMargin-guide-constraint' H:[UILayoutGuide:0x1c41b88e0'UIViewLayoutMarginsGuide']-(0)-|(LTR)   (active, names: '|':_UIButtonBarStackView:0x125e10970 )>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x1c42889d0 H:[_UIModernBarButton:0x125e33a00]-(>=5)-|   (active, names: '|':_UIButtonBarButton:0x125e333b0 )>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2017-11-07 21:28:10.485532-0500 test[1049:199135] [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:0x1c42894c0 h=-&- v=-&- UIToolbar:0x125d24040.width == _UIInputViewContent:0x125d232c0.width   (active)>",
    "<NSAutoresizingMaskLayoutConstraint:0x1c4289600 h=--& v=--& _UIInputViewContent:0x125d232c0.width == 0   (active)>",
    "<NSLayoutConstraint:0x1c4281360 H:|-(0)-[_UIButtonBarStackView:0x125e10970]   (active, names: '|':_UIToolbarContentView:0x125d24480 )>",
    "<NSLayoutConstraint:0x1c42813b0 _UIButtonBarStackView:0x125e10970.trailing == _UIToolbarContentView:0x125d24480.trailing + 8   (active)>",
    "<NSLayoutConstraint:0x1c0282df0 _UIToolbarContentView:0x125d24480.trailing == UIToolbar:0x125d24040.trailing   (active)>",
    "<NSLayoutConstraint:0x1c0282e90 H:|-(0)-[_UIToolbarContentView:0x125d24480]   (active, names: '|':UIToolbar:0x125d24040 )>",
    "<NSLayoutConstraint:0x1c4288340 H:|-(0)-[_UIModernBarButton:0x125e320c0]   (active, names: '|':_UIButtonBarButton:0x125e31e70 )>",
    "<NSLayoutConstraint:0x1c4288390 H:[_UIModernBarButton:0x125e320c0]-(>=8)-|   (active, names: '|':_UIButtonBarButton:0x125e31e70 )>",
    "<NSLayoutConstraint:0x1c028d5c0 H:|-(8)-[_UIModernBarButton:0x125d4fa20'Done']   (active, names: '|':_UIButtonBarButton:0x125e34320 )>",
    "<NSLayoutConstraint:0x1c028d610 H:[_UIModernBarButton:0x125d4fa20'Done']-(0)-|   (active, names: '|':_UIButtonBarButton:0x125e34320 )>",
    "<NSLayoutConstraint:0x1c028d9d0 'UISV-canvas-connection' UILayoutGuide:0x1c41b88e0'UIViewLayoutMarginsGuide'.leading == _UIButtonBarButton:0x125e31e70.leading   (active)>",
    "<NSLayoutConstraint:0x1c028db10 'UISV-canvas-connection' UILayoutGuide:0x1c41b88e0'UIViewLayoutMarginsGuide'.trailing == _UIButtonBarButton:0x125e34320.trailing   (active)>",
    "<NSLayoutConstraint:0x1c028db60 'UISV-spacing' H:[_UIButtonBarButton:0x125e31e70]-(0)-[UIView:0x125e331d0]   (active)>",
    "<NSLayoutConstraint:0x1c028dbb0 'UISV-spacing' H:[UIView:0x125e331d0]-(0)-[_UIButtonBarButton:0x125e333b0]   (active)>",
    "<NSLayoutConstraint:0x1c028dc00 'UISV-spacing' H:[_UIButtonBarButton:0x125e333b0]-(0)-[UIView:0x125e34140]   (active)>",
    "<NSLayoutConstraint:0x1c028dc50 'UISV-spacing' H:[UIView:0x125e34140]-(0)-[_UIButtonBarButton:0x125e34320]   (active)>",
    "<NSLayoutConstraint:0x1c409e1e0 'UIView-leftMargin-guide-constraint' H:|-(0)-[UILayoutGuide:0x1c41b88e0'UIViewLayoutMarginsGuide'](LTR)   (active, names: '|':_UIButtonBarStackView:0x125e10970 )>",
    "<NSLayoutConstraint:0x1c4281130 'UIView-rightMargin-guide-constraint' H:[UILayoutGuide:0x1c41b88e0'UIViewLayoutMarginsGuide']-(0)-|(LTR)   (active, names: '|':_UIButtonBarStackView:0x125e10970 )>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x1c4288390 H:[_UIModernBarButton:0x125e320c0]-(>=8)-|   (active, names: '|':_UIButtonBarButton:0x125e31e70 )>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
[LayoutConstraints]无法同时满足约束。
可能下面列表中至少有一个约束是您不想要的。
试试这个:
(1) 看看每一个约束,试着找出你不期望的;
(2) 找到添加了不需要的约束的代码,然后修复它。
(注意:如果您看到不理解的NSAutoresizingMaskLayoutConstraints,请参阅UIView属性TranslatesAutoResizingMaskToConstraints的文档)
(
"",
"",
"",
"",
"",
"",
“=5)-[UIModernBarButton:0x125e33a00](活动,名称:‘|’:UIButtonBarButton:0x125e333b0)>”,
“=5)-|(活动,名称:‘|’:UIButtonBarButton:0x125e333b0)>”,
"",
"",
"",
"",
"",
"",
"",
"",
"",
""
)
将尝试通过打破约束进行恢复
=5)-|(活动,名称:'|':_UIButtonBarButton:0x125e333b0)>
在UIViewAlertForUnsatifiableConstraints处创建一个符号断点,以便在调试器中捕获该断点。
中列出的UIView上UIConstraintBasedLayoutDebugging类别中的方法也可能会有所帮助。
2017-11-07 21:28:10.485532-0500测试[1049:199135][布局约束]无法同时满足约束。
可能下面列表中至少有一个约束是您不想要的。
试试这个:
(1) 看看每一个约束,试着找出你不期望的;
(2) 找到添加了不需要的约束的代码,然后修复它。
(注意:如果您看到不理解的NSAutoresizingMaskLayoutConstraints,请参阅UIView属性TranslatesAutoResizingMaskToConstraints的文档)
(
"",
"",
"",
"",
"",
"",
"",
“=8)-|(活动,名称:‘|’:UIButtonBarButton:0x125e31e70)>”,
"",
"",
"",
"",
"",
"",
"",
"",
"",
""
)
将尝试通过打破约束进行恢复
=8)-|(活动,名称:'|':_UIButtonBarButton:0x125e31e70)>
在UIViewAlertForUnsatifiableConstraints处创建一个符号断点,以便在调试器中捕获该断点。
中列出的UIView上UIConstraintBasedLayoutDebugging类别中的方法也可能会有所帮助。

单击表单中的输入时,如何使WKWebView具有有效的约束?

在哪里设置约束?在情节提要或代码中?我没有在情节提要或代码中设置任何约束。我只是将视图设置为webView。你能理解吗?我遇到了同样的问题。我的WKWebView与interface builder中的安全区域相关联。不,我们最终将iOS应用程序放在了表格上,以关注其他事项。可能是iOS 11中的一个bug: