xcode 无法打开主故事板
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16448594/
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
Main Storyboard Can't be Opened
提问by user2355857
I am trying to build this app for school using the simulator but whenever I try to build it I get this error:
我正在尝试使用模拟器为学校构建这个应用程序,但是每当我尝试构建它时,我都会收到此错误:
The document "MainStoryboard_iPhone.storyboard" could not be opened. Line 134: XML
declaration allowed only at the start of the document
I go to the Issue navigator but that is all it shows. There are no errors shown in the code.
我转到问题导航器,但这就是它显示的全部内容。代码中没有显示错误。
Here is the section where line 134 is in the XML source code:
这是 XML 源代码中第 134 行的部分:
</view>
<tabBarItem key="tabBarItem" title="Item 1" id="JGk-R6-tUe"/> //This
is line 134
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="2cL-Ur-7Xa"
userLabel="First Responder" sceneMemberID="firstResponder"/>
采纳答案by theMikeSwan
Either edit the storyboard file so that Xcode re-saves it or open it in a text editor and see if line 134 needs to be edited or deleted. It sounds like somehow there is a second tag saying that it is an XML file on line 134.
编辑故事板文件,以便 Xcode 重新保存它,或者在文本编辑器中打开它,看看第 134 行是否需要编辑或删除。听起来好像有第二个标签说它是第 134 行的 XML 文件。
回答by JoePasq
You can right click on the Storyboard file and view it as XML source code.
您可以右键单击 Storyboard 文件并将其作为 XML 源代码查看。
From there you can go to the offending line, read the XML and make edits that in your best judgement will fix it.
从那里您可以转到有问题的行,阅读 XML 并进行编辑,以根据您的最佳判断来修复它。