xcode 故事板 - 不支持的配置 8 个冲突约束

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18520765/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 03:44:51  来源:igfitidea点击:

Storyboard - Unsupported configuration 8 conflicting constrains

iosxcodestoryboard

提问by user1509593

I am using storyboard autolayout. I am noticing today, while compiling a warning message

我正在使用故事板自动布局。我今天注意到,在编译警告消息时

MainStoryboard_iphone.storyboard
Unsupported Configuration
8 conflicting constraints

Clicking on warning takes to storyboard, but not to view which is a problem. Is there a way to figure out which view/control has the problem

单击警告会进入故事板,但不会查看哪个是问题。有没有办法找出哪个视图/控件有问题

Thanks

谢谢

回答by Andrew Porritt

Right click on the "8 conflicting constraints" and select "Reveal in log". There should be a line with something like the following in your log:

右键单击“8 个冲突约束”并选择“在日志中显示”。您的日志中应该有一行类似于以下内容:

/path/to/storyboard/Storyboard_iPad.storyboard:8or-pl-jNO: warning: 2 conflicting constraints

/path/to/storyboard/Storyboard_iPad.storyboard:8or-pl-jNO: 警告: 2 个冲突的约束

The part between the colons between the storyboard path and the warning (8or-pl-jNO in my case) is the ID of the constraint that caused the issue.

故事板路径和警告(在我的例子中为 8or-pl-jNO)之间冒号之间的部分是导致问题的约束的 ID。

To find the constraint, right click on your storyboard file in the project navigator, then Open As -> Source Code, then search for the ID of the constraint. You should then be able to find what View it is contained in in the XML, then you can switch back to Interface Builder (Open As -> Interface Build - iOS Storyboard), then find the view that contained the constraint, and find the constraint that caused the problem. You can select the constraints in the document outline, then check their ID in the Identity Inspector at the right hand side, under the Document section, named Object ID.

要查找约束,请在项目导航器中右键单击您的故事板文件,然后打开为 -> 源代码,然后搜索约束的 ID。然后你应该能够找到它包含在XML中的View,然后你可以切换回Interface Builder(Open As -> Interface Build - iOS Storyboard),然后找到包含约束的视图,并找到约束这导致了问题。您可以在文档大纲中选择约束,然后在右侧的身份检查器中检查它们的 ID,在名为 Object ID 的 Document 部分下。

回答by ZYiOS

@Andrew Porritt 's answer not work in my case, I use Xcode 6. The warning reads:

@Andrew Porritt 的答案在我的情况下不起作用,我使用 Xcode 6。警告内容如下:

"Unsupported Configuration of constraint attributes. This may product unexpected results at runtime and is not compatible with Xcode versions prior to 5.1"

"Attribute Unavaliable" (e.g. I use preferred max layout width)

I can't open the log file, what I did is open the storyboard file as source code, so the warnings will appear at the corresponding line(just like shown as in the .swift/.m source code)

我无法打开日志文件,我所做的是将故事板文件作为源代码打开,因此警告会出现在相应的行(就像.swift/.m 源代码中所示)