“目标文件格式无法识别、无效或不合适”Xcode 错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7339600/
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
"object file format unrecognized, invalid, or unsuitable" Xcode error
提问by Peter V
I don't see any reasons why this message should come at the end of the log:
我没有看到为什么这条消息应该出现在日志末尾的任何原因:
/Users/Val/Library/Developer/Xcode/DerivedData/Mathematics-dzakmzlewrmgvibasvuixiwmkwwp/Build/Products/Debug-iphoneos/Mathematics.app: object file format unrecognized, invalid, or unsuitable
Command /usr/bin/codesign failed with exit code 1
How can I fix this error?
I am desperate, all my certificates and profiles are valid, the app itself has no bugs at all.
我该如何解决这个错误?
我很绝望,我所有的证书和配置文件都是有效的,应用程序本身根本没有错误。
采纳答案by HelloWorld
Make sure the 'Executable Name' (CFBundleExecutable) entry in your target's info.plist matches the 'Product Name' specified in your target settings.
确保目标的 info.plist 中的“可执行文件名称”(CFBundleExecutable)条目与目标设置中指定的“产品名称”匹配。
回答by Ray Hunter
I ran into the same issue with Xcode 7.0.1 and cocoapods. I ended up doing the following:
我在 Xcode 7.0.1 和 cocoapods 上遇到了同样的问题。我最终做了以下事情:
- Closed Xcode
Removed everything under my DerivedData folder
rm -fr /Users/{user}/Library/Developer/Xcode/DerivedData/*
Restarted Xcode and rebuilt the project
- 关闭的Xcode
删除了我的 DerivedData 文件夹下的所有内容
rm -fr /Users/{user}/Library/Developer/Xcode/DerivedData/*
重新启动Xcode并重建项目
回答by Ken Pletzer
For me, this turned out to be the Build Settings/Build Option/Compiler for C/C++/Objective C had become mismatched between Project and Target ... set to default in each case and problem resolved.
对我来说,结果是 C/C++/Objective C 的构建设置/构建选项/编译器在 Project 和 Target 之间变得不匹配......在每种情况下都设置为默认值并解决了问题。
回答by Brett Colbert
After battling this error for about 2 weeks and trying every suggested solution, in my case the problem was the following:
在与此错误斗争了大约 2 周并尝试了所有建议的解决方案后,就我而言,问题如下:
*Under Project --> Build Settings --> Build Options, the "Build Variants" was set to something different than Targets --> Build Settings --> Build Options --> Build Variants
*在项目 --> 构建设置 --> 构建选项下,“构建变体”设置为与目标不同的东西 --> 构建设置 --> 构建选项 --> 构建变体
Make sure these are set to the same setting, which should be "normal".
确保这些设置为相同的设置,应该是“正常”。
That change finally got rid of the usr/bin/codesign failed with exit code 1.
该更改最终摆脱了 usr/bin/codesign failed with exit code 1。
回答by Gerardo
For me, the solution was:
对我来说,解决方案是:
- Navigate to YOURPROJECTNAME.xcodeproj
- Right Click and Show the content of package
- Enter to xcuserdata and remove all users folders
- Right Click on project.xcworkspace and Show the content of package
- Enter to xcuserdata and remove all users folders
- 导航到 YOURPROJECTNAME.xcodeproj
- 右键单击并显示包的内容
- 进入 xcuserdata 并删除所有用户文件夹
- 右键单击 project.xcworkspace 并显示包的内容
- 进入 xcuserdata 并删除所有用户文件夹