首页 > 解决方案 > 项目“Project-Name”已损坏,由于解析错误而无法打开

问题描述

项目“Project-Name”已损坏,由于解析错误而无法打开。检查项目文件是否存在无效编辑或未解决的源代码管理冲突。

网上其他解决方案描述实际项目文件中存在未解决的冲突:project.pbxproj

但是,这没有任何意义,因为我手动指定了所有传入的更改:

git merge {Branch-Name} --strategy-option theirs

我也尝试过定期合并并在 vim 中手动解决冲突,因为无法使用 Xcode 打开项目。

此外,在 中没有明显的合并冲突,project.pbxproj因为带有参数的 cmd+f<<<< >>>>====在整个文件中不会产生任何结果。

此外,这在项目中经常发生,我不确定为什么。也许我的有问题.gitignore

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
firebase-debug.log*

# Firebase cache
.firebase/

# Firebase config

# Uncomment this if you'd like others to create their own Firebase project.
# For a team working on the same Firebase project(s), it is recommended to leave
# it commented so all members can deploy to the same project(s) in .firebaserc.
# .firebaserc

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# Mac OS X
*.DS_Store

# Xcode
*.pbxuser
*.mode1v3
*.mode2v3
*.perspectivev3
*.xcuserstate
Bucket.xcworkspace/
xcuserdata/

# Cocoapodsl
Pods/

标签: xcodegit

解决方案


但是,这没有任何意义,因为我手动指定了所有传入的更改:

git merge {Branch-Name} --strategy-option theirs

这没有任何帮助。您所说的文件是 XML 文件,Git 的合并算法无法正确合并这些文件。-X theirsor--strategy-option theirs只是告诉 Git相信它正确地合并了它们,即使它没有。

必须手动合并这些文件——或者编写一个 XML 合并程序,但这太难了,以至于还没有人做过。或者,根本不合并项目文件:使用您可用的任何项目文件编写器软件编写一个新文件。(在允许合并冲突,您也可以使用git checkout --theirs; 直接获取他们的文件,但这可能会丢失您自己一方的重要信息。)


推荐阅读