git pull后无法打开xib文件,元素名称无效
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21818821/
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
Couldn't open xib file after git pull, invalid element name
提问by Abo3atef
I am working on project with another developer. We are working on bitbucket.
我正在与另一位开发人员合作进行项目。我们正在研究 bitbucket。
The problem is he made a changes in XIB files. After that when I do a git pull
, I receive the changes but get an error on XIB files. When I tried to open it, a show alert message saying could not opened
问题是他对 XIB 文件进行了更改。之后,当我执行 a 时git pull
,我收到更改但在 XIB 文件上出现错误。当我试图打开它时,显示提示消息说无法打开
Line 81 startTag: invalid element name.
Line 81 startTag: invalid element name.
Thanks :)
谢谢 :)
采纳答案by Abo3atef
I think @Tom Harrington is right, xib file was corrupted, So
我认为@Tom Harrington 是对的,xib 文件已损坏,所以
- I cancelled the last pull.
- Made the changes by my self in XIB.
- Take a copy from that XIB.
- git pull
- Delete the XIB in Xcode ( which was corrupted ).
- Added the external copy from modified XIB file.
- 我取消了最后一次拉动。
- 我自己在 XIB 中进行了更改。
- 从该 XIB 中获取副本。
- 拉
- 删除 Xcode 中的 XIB(已损坏)。
- 添加了来自修改后的 XIB 文件的外部副本。
Then every thing works great. Thanks guys :)
然后一切都很好。谢谢你们 :)
回答by tokyovariable
Glad you corrected the issue. I recently ran into the same issue. It a merge conflict and that is why Xcode is throwing that error. Within the .xib
file you will see something like:
很高兴你纠正了这个问题。我最近遇到了同样的问题。这是一个合并冲突,这就是 Xcode 抛出该错误的原因。在.xib
文件中,您将看到如下内容:
<<<<<<< HEAD
// code
=======
// code
>>>>>>> apps
You can do what you did above, or manually correct the merge conflict issues by opening the .xib file in a text editor. After correcting it the file should open fine in Xcode.
您可以执行上述操作,或者通过在文本编辑器中打开 .xib 文件来手动更正合并冲突问题。更正后,文件应该可以在 Xcode 中正常打开。
回答by Nathan Singer
All you have to do is find the <<<<<<< HEAD
lines and delete them. Compiled on my first try. For some reason they are inserted into the .xib file when you have a merge conflict.
您所要做的就是找到这些<<<<<<< HEAD
行并删除它们。在我第一次尝试时编译。出于某种原因,当您遇到合并冲突时,它们会被插入到 .xib 文件中。
回答by Jiraheta
Not sure if this will help anyone in the future, but you can right-click on the nib file (xib) file and open it as a source code. Search for either <<<<<<< HEAD or === or just go through it and you will be able to quickly pick what shouldn't be there. Save it, right click on it and open it as storyboard again. XCode at this point should message you that there were some inconsistencies in the file that have been taken care of. You should be able to work on it now.
不确定这是否会对将来的任何人有所帮助,但您可以右键单击 nib 文件 (xib) 文件并将其作为源代码打开。搜索 <<<<<<< HEAD 或 === 或只是通过它,您将能够快速选择不应该存在的内容。保存它,右键单击它并再次将其作为故事板打开。此时 XCode 应该会向您发送消息,说明文件中存在一些已处理的不一致问题。你现在应该可以开始工作了。
回答by Jayprakash Dubey
When you take a pull <<<<< HEADand <<<<< Mastersection is created for files that is modified locally as well as on remote. You need to decide which one to deleteand make sure to mark it as conflict resolved.
当您拉取<<<<< HEAD和<<<<<为本地和远程修改的文件创建主部分时。您需要决定删除哪一个,并确保将其标记为已解决冲突。
Now, when it comes to XIB files this too has <<<<< HEADand <<<<< Masterin XML file. If you're confident enough to read XIB file and remove HEAD and then mark it as resolve conflicts!Otherwise discard the XIB changes and mark it as resolved!I would prefer to go with later one.
现在,当涉及到 XIB 文件时,XML 文件中也有<<<<< HEAD和<<<<< Master。如果您有足够的信心阅读 XIB 文件并删除 HEAD,然后将其标记为解决冲突!否则丢弃 XIB 更改并将其标记为已解决!我更愿意和以后一起去。
回答by A.G
I worked as the following:
我的工作如下:
- Find <<<<<<< HEAD in the Journal and Conflict Resolver.
- Delete them all (Delete -> Revert). We can check whether the storyboard changes are resolved by manually opening the project storyboard. It will definitely throw error with line number.
- Stage -> Commit -> Commit All changes
- Pull again.
- Push the same.
- 在日志和冲突解决程序中找到 <<<<<<< HEAD。
- 将它们全部删除(删除 -> 还原)。我们可以通过手动打开项目故事板来检查故事板更改是否得到解决。它肯定会抛出行号错误。
- 阶段 -> 提交 -> 提交所有更改
- 再拉。
- 推一样。
If anything is new being added, manually share the project storyboard between people, make team member's UI changes to one storyboard and push it. Rest of the teammates must clone the project to continue.
如果添加了任何新内容,请在人与人之间手动共享项目故事板,将团队成员的 UI 更改为一个故事板并推送它。其他队友必须克隆项目才能继续。
Cloning the project:
克隆项目:
- Delete the project from Documents directory(where it is saved)
- Open SmartGit. Select Remove from the dialogue box.
- Repository -> Clone -> Set Repository URL -> Continue
- Include modules & Submodules -> Add path of local directory -> Finish
- Once the project is cloned, make a pull.
- 从 Documents 目录(保存项目)中删除项目
- 打开 SmartGit。从对话框中选择删除。
- 存储库 -> 克隆 -> 设置存储库 URL -> 继续
- 包含模块和子模块 -> 添加本地目录路径 -> 完成
- 克隆项目后,进行拉取。
回答by MRizwan33
Here is the solution. It helped me. It is because of multiple git pull request.
这是解决方案。它帮助了我。这是因为多个 git pull 请求。
Go to your storyboard source code (right click on storyboard go Open As then go Source Code)
tab cmd+f and type HEAD then return.
You will see multiple HEAD name starting from the line beginning. like this format.HEAD and equal and greater then signs are shown
just remove the code you don't want any of selected part given in the image also remove other keyword shown.equals and greater then signs section of codeHEAD to equal signs code
Also remove the HEAD, equal, greater then signs. just left any one line in between these codes.(the xml line code you want to remain)
Thats it just right click the storyboard and click on interface builder view.
转到您的故事板源代码(右键单击故事板转到“打开为”然后转到“源代码”)
tab cmd+f 并输入 HEAD 然后返回。
您将看到从行开头开始的多个 HEAD 名称。喜欢这种格式。HEAD 和等于和大于然后显示符号
只需删除您不希望图像中给出的任何选定部分的代码,同时删除显示的其他关键字。等于和大于然后将代码HEAD 的部分符号为等号代码
还要删除 HEAD,等于,大于符号。只在这些代码之间留下任何一行。(你想保留的 xml 行代码)
就是这样,只需右键单击情节提要并单击界面构建器视图。