Xcode - 错误:无法打开可执行文件.....如何修复?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8345682/
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
Xcode - error: unable to open executable.....how to fix?
提问by StuartB
my first iPhone app is ready for submission using the Application Uploader. I think I understand that I have to create the file by going Product : Archivein Xcode, but when I do I get this message:
我的第一个 iPhone 应用程序已准备好使用 Application Uploader 提交。我想我知道我必须通过在 Xcode 中转到Product : Archive来创建文件,但是当我这样做时,我收到以下消息:
error: unable to open executable '/Users/Library/Developer/Xcode/DerivedData/test-euevazxsqeehnwantvxjhqwkytxr/ArchiveIntermediates/test/InstallationBuildProductsLocation/Applications/test.app/test'
错误:无法打开可执行文件“/Users/Library/Developer/Xcode/DerivedData/test-euevazxsqeehnwantvxjhqwkytxr/ArchiveIntermediates/test/InstallationBuildProductsLocation/Applications/test.app/test”
The app builds and runs fine on my phone and on the simulator, so please can I have some advice on how to fix this? Thank you.
该应用程序在我的手机和模拟器上构建并运行良好,所以我可以就如何解决这个问题提供一些建议吗?谢谢你。
回答by RomanN
You can also get this error if you've included .m file instead of the .h file somewhere in your code.
如果您在代码中的某处包含 .m 文件而不是 .h 文件,您也可能会收到此错误。
回答by jrtc27
Product>Clean
and Product>Clean Build Folder
(hold down option for it to appear). Quit Xcode and reopen and all should be well. If not, go into the Organizer, choose Projects, find Test and delete its DerivedData folder (IMPORTANT: NOT SNAPSHOTS).
Product>Clean
和Product>Clean Build Folder
(按住选项让它出现)。退出 Xcode 并重新打开,一切都会好起来的。如果没有,进入 Organizer,选择 Projects,找到 Test 并删除它的 DerivedData 文件夹(重要:不是快照)。
回答by Saad
this error is due to some class level things when u name class and generates it's properties' getter setter with @synthesize. it generates methods with get and set names included with properties. Probably you have some class containing such names. The exact way to find out is to click your issue navigator in navigator box. and then click the error. read the green area. you will find out what you have. and now remove that class or what ever it is. create it again with some different name now. prblm will be solved.
这个错误是由于一些类级别的事情,当你命名类并使用@synthesize 生成它的属性的 getter setter 时。它生成带有属性中包含的 get 和 set 名称的方法。可能您有一些包含此类名称的类。找出问题的确切方法是在导航器框中单击您的问题导航器。然后单击错误。阅读绿色区域。你会发现你有什么。现在删除该类或它是什么。现在用一些不同的名称再次创建它。prblm 将得到解决。
回答by Ben Baron
In my case, this turned out to be caused by an invalid library (specifically an old version of libz). Once I deleted that from my frameworks folder, and added the correct libz library in the build phases section of the target settings, it built as normal.
就我而言,这是由无效库(特别是旧版本的 libz)引起的。一旦我从我的框架文件夹中删除了它,并在目标设置的构建阶段部分添加了正确的 libz 库,它就会正常构建。
回答by Arvind
You can get this type of error if your class' .m file is not listed under the "Compile Sources" step of the "Build Phases" tab of your target. Normally Xcode does this for you, but sometimes it loses the plot and you need to add the .m file manually.
如果您的类的 .m 文件未在目标的“构建阶段”选项卡的“编译源”步骤下列出,您可能会收到此类错误。通常 Xcode 会为您执行此操作,但有时它会丢失绘图,您需要手动添加 .m 文件。
回答by SubstanceMX
I had to dispose all linker flags in the main project (workspaces) and leave it only in the dependences.
我必须在主项目(工作区)中处理所有链接器标志,并将其仅留在依赖项中。
//:configuration = Debug OTHER_LDFLAGS = -ObjC -M -all_load
//:configuration = 调试 OTHER_LDFLAGS = -ObjC -M -all_load
//:configuration = Release OTHER_LDFLAGS = -ObjC -M -all_load
//:configuration = 释放 OTHER_LDFLAGS = -ObjC -M -all_load
//:completeSettings = some OTHER_LDFLAGS
//:completeSettings = 一些 OTHER_LDFLAGS
回答by Dan Wesnor
You'll get this error if any symbol is duplicated anywhere in the project. Most linkers issue a "duplicate symbol" error and tell you the name of the symbol and the file(s) it's have a problem with, but that isn't very Apple-like.
如果任何符号在项目中的任何位置重复,您都会收到此错误。大多数链接器会发出“重复符号”错误,并告诉您符号的名称和它有问题的文件,但这并不像 Apple 那样。
Lord knows what error they issue when the linker can't actually open the file.
天知道当链接器无法实际打开文件时他们会发出什么错误。
回答by Idan Magled
Had the same problem today.
今天遇到了同样的问题。
Xcode build path probably got a little crazy and lost the connection with my libGoogleAdMobAds.a
or my libGoogleAnalyticsServices.a
files.
Xcode 构建路径可能有点疯狂并且失去了与我libGoogleAdMobAds.a
或我的libGoogleAnalyticsServices.a
文件的连接。
Delete them import them back - fixed.
删除它们将它们重新导入 - 已修复。
Hoped I helped.
希望我有所帮助。