简体   繁体   English

升级到 Xcode 12 后的故事板错误

[英]Storyboard Error after Upgrading to Xcode 12

Since I switched to Xcode 12 I have problems with my storyboard.自从我切换到 Xcode 12 以来,我的故事板出现了问题。 When I open the storyboard file if shows the following error:当我打开故事板文件时,如果显示以下错误:

The document “Main.storyboard” had 97 issues that were found and repaired.文档“Main.storyboard”有 97 个被发现和修复的问题。 This may be due to an SCM operation such as merging.这可能是由于 SCM 操作(例如合并)所致。 Please save the document to fix the issues.请保存文档以解决问题。

错误截图

I opened the file as source code and found indeed a lot of duplicates inside the <resources> tag.我将文件作为源代码打开,发现<resources>标签内确实有很多重复项。 Those duplicates look like this:这些重复看起来像这样:

<systemColor name="darkTextColor">
<color white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> 
</systemColor>

I started removing those duplicates, so that only one entry is left.我开始删除这些重复项,因此只剩下一个条目。 Then I opened the file again in Interface Builder.然后我在 Interface Builder 中再次打开了该文件。 Now I does not show the error mentioned above but it still says: " An internal error occurred. Editing functionality may be limited. "现在我没有显示上面提到的错误,但它仍然说:“发生内部错误。编辑功能可能受到限制。

Now if I close the file and open it again, Xcode is automatically adding the duplicates mentioned above again and the error " The document “Main.storyboard” had 97 issues that were found and repaired. " is displayed again.现在,如果我关闭文件并再次打开它,Xcode 会再次自动添加上述重复项,并再次显示错误“ The document “Main.storyboard” had 97 issues that were found and repaired。 ”。

This procedure repeats again and again if I continue removing the duplicates...如果我继续删除重复项,这个过程会一次又一次地重复......

UPDATE更新

I reached out to Apple Developer Technical Support and got the advice to replace all occurrences of groupTableViewBackgroundColor with systemGroupedBackgroundColor .我伸手苹果开发技术支持,并得到了建议,以取代所有出现groupTableViewBackgroundColorsystemGroupedBackgroundColor

I have done this and now the error mentioned above does not show up anymore but editing functionalities is still limited in my storyboard and I see those blue boxes around my view controllers.我已经这样做了,现在上面提到的错误不再出现,但我的故事板中的编辑功能仍然有限,我看到我的视图控制器周围的那些蓝色框。 I hope a future Xcode version will fix this.我希望未来的 Xcode 版本能够解决这个问题。

I faced the same issue regarding the "An internal error occurred. Editing functionality may be limited."我遇到了关于“发生内部错误。编辑功能可能受限”的相同问题。 message in Xcode and found that it was related to the UISplitViewController im my storyboard. Xcode 中的消息,发现它与我的故事板中的UISplitViewController相关。 If your storyboard uses a UISplitViewController , select it in Xcode and verify the value of the "Style" property in the Attributes Inspector.如果您的故事板使用UISplitViewController ,请在 Xcode 中选择它并验证属性检查器中“样式”属性的值。 For me it was set to "Unspecified (Discouraged)".对我来说,它被设置为“未指定(不鼓励)”。 After I changed it to "Double Column", saved the storyboard, closed the storyboard (you may just want to close the whole Xcode project) and opened the storyboard/project again, everything worked fine.在我将其更改为“双列”,保存故事板,关闭故事板(您可能只想关闭整个 Xcode 项目)并再次打开故事板/项目后,一切正常。

(And thanks for your update regarding replacing groupTableViewBackgroundColor with systemGroupedBackgroundColor – I had to do this too.) (并感谢您对替换更新groupTableViewBackgroundColorsystemGroupedBackgroundColor -我不得不这样做了。)

I found the same problem.我发现了同样的问题。 Probably is an Xcode issue, it will be resolved in the next version.可能是 Xcode 的问题,下个版本会解决。 Anyway, it is annoying, but it hasn't any effect.无论如何,它很烦人,但它没有任何影响。

Update: it seems that the problem only affects two kind of attributes: darkTextColor and GroupTableColour (Secondary, Tertiary...).更新:似乎该问题只影响两种属性:darkTextColor 和 GroupTableColour(二级、三级...)。 Changing them with other attributes (like "Default label colour") solves the problem.使用其他属性(如“默认标签颜色”)更改它们可以解决问题。 Wierd!奇怪!

EDITED: Solved with Xcode 12.3编辑:用 Xcode 12.3 解决

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM