Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/94.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 为什么我的模拟得到的是一个空白的黑屏,必须以编程方式处理锚/约束?_Ios_Swift_Xcode_Autolayout - Fatal编程技术网

Ios 为什么我的模拟得到的是一个空白的黑屏,必须以编程方式处理锚/约束?

Ios 为什么我的模拟得到的是一个空白的黑屏,必须以编程方式处理锚/约束?,ios,swift,xcode,autolayout,Ios,Swift,Xcode,Autolayout,这是我的密码。我试图将webView锚点的顶部约束到视图控制器顶部布局指南的底部,但我只是得到一个黑屏,有时控制台中出现错误: 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 constrai

这是我的密码。我试图将webView锚点的顶部约束到视图控制器顶部布局指南的底部,但我只是得到一个黑屏,有时控制台中出现错误:

 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) 
(
    "<_UILayoutSupportConstraint:0x608000284d30 _UILayoutSpacer:0x6080001aa560'UIVC-topLayoutGuide'.height == 20   (active)>",
    "<_UILayoutSupportConstraint:0x6080002850a0 V:|-(0)-[_UILayoutSpacer:0x6080001aa560'UIVC-topLayoutGuide']   (active, names: '|':UIView:0x7fcfcac26cd0 )>",
    "<NSAutoresizingMaskLayoutConstraint:0x608000280fa0 h=--& v=--& WKWebView:0x7fcfcb09a400.midY == 0   (active)>",
    "<NSAutoresizingMaskLayoutConstraint:0x608000280ff0 h=--& v=--& WKWebView:0x7fcfcb09a400.height == 0   (active)>",
    "<NSLayoutConstraint:0x6080002846f0 V:[_UILayoutSpacer:0x6080001aa560'UIVC-topLayoutGuide']-(3)-[WKWebView:0x7fcfcb09a400]   (active)>",
    "<NSAutoresizingMaskLayoutConstraint:0x608000281220 h=--& v=--& 'UIView-Encapsulated-Layout-Top' UIView:0x7fcfcac26cd0.minY == 0   (active, names: '|':UIViewControllerWrapperView:0x7fcfcac08120 )>"
)

添加导航代理:

webView.navigationDelegate = self

然后聆听错误和导航代理,您将能够看到到底发生了什么或没有发生什么。

不知道哪个约束被自动打破-如果这不能解决问题,请添加它-我注意到几个NSAutoResizingMaskLayoutConstraint问题。你需要为每个视图设置掩码为false。对不起Rohan…添加什么?那条被注释掉的线?是的。我没看到你把那评论出来。同样,如果这不起作用,请向约束转储(它做了什么?)和您设置的其他约束添加更多内容。这是我在此控制器内设置的唯一约束,当窗口加载视图时,我仍然会看到一个空白的黑屏。希望我们不会被要求去聊天。请给我们所有的约束问题-它应该总是告诉我们它将打破什么约束-以及*所有约束-在代码和IB中,以及任何superview约束。如果没有它,就不可能调试约束问题。(除非有人忘记/注释关闭自动调整大小掩码)。
webView.navigationDelegate = self