Xcode 4 - 启动可执行文件时出错
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5266895/
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 4 - Error Starting Executable
提问by The Maniac
I've been working on a project in Xcode 3.2.5 and today I tried migrating it up to Xcode 4.0. It compiles just fine; I can navigate to and execute the .app without a hitch (as expected). The only thing that is screwy is the fact that Xcode cannot launch the application, and displays the following error when it tries:
我一直在 Xcode 3.2.5 中开发一个项目,今天我尝试将它迁移到 Xcode 4.0。它编译得很好;我可以毫无障碍地导航到并执行 .app(正如预期的那样)。唯一的问题是 Xcode 无法启动应用程序,并在尝试时显示以下错误:
"Error starting executable. No executable file specified. Use the "file" or "exec-file" command" (image not available)
“启动可执行文件时出错。未指定可执行文件。使用“file”或“exec-file”命令”(图像不可用)
I've scoured the Project and Xcode settings and have been googling for half the day, but all I can find are dead ends and people bashing other people about breaking Apple NDA. FYI Xcode 4 has been released, and is no longer under NDA.
我已经搜索了 Project 和 Xcode 设置,并在谷歌上搜索了半天,但我能找到的只是死胡同,人们抨击其他人违反 Apple NDA。仅供参考 Xcode 4 已发布,不再处于保密协议之下。
Should I just start a new project and copy in my source? Sounds wrong to me, but brute force works when brute force works.
我应该开始一个新项目并复制我的源代码吗?对我来说听起来不对,但是当蛮力起作用时,蛮力才起作用。
Thanks in advance
提前致谢
回答by Joshua Nozzi
At a guess, the schemes it set up for you based on your v3 targets and build settings might not be quite right. From the schemes menu, choose to edit the current scheme, then select the Run action from the list and make sure the appropriate exectuable is selected.
猜测,它根据您的 v3 目标和构建设置为您设置的方案可能不太正确。从方案菜单中,选择编辑当前方案,然后从列表中选择运行操作并确保选择了适当的可执行文件。
回答by Alex Zavatone
Robert Harvery. Do not delete my post without telling me why you deleted it. That's rude.
罗伯特·哈维。不要在没有告诉我你为什么删除它的情况下删除我的帖子。很不礼貌。
I ran into the same issue this question came up so I spent my time identifying the issue, reproducing the issue, narrowing it down and explaining as best I could how to not make it happen - as well as the general frustration that comes with an issue like this (it hit me on 2 different versions of Xcode in 2 weeks).
我遇到了同样的问题,这个问题出现了,所以我花时间确定问题,重现问题,缩小范围并尽我所能解释如何不让它发生 - 以及问题带来的普遍挫败感像这样(它在 2 周内让我在 2 个不同版本的 Xcode 上受到了打击)。
If you're going to delete my post then at least take the time to try and answer the question as I had tried to do.
如果你要删除我的帖子,那么至少花时间像我一样尝试回答这个问题。
Now, on to the reply that actually tells how this issue may be created and how to avoid that.
现在,回到实际说明如何创建此问题以及如何避免该问题的回复。
I JUST had this happen creating an app for iOS. Why? I renamed my target executable.
我刚刚发生了这种情况,为 iOS 创建了一个应用程序。为什么?我重命名了目标可执行文件。
Just tested this by checking out a new copy of the source and rebuilding.
刚刚通过检查源的新副本并重建来测试这一点。
The app ran fine on my device.
该应用程序在我的设备上运行良好。
Went in to Xcode 4.2, renamed the target. Ran the app. "Error starting Executable..."
进入 Xcode 4.2,重命名目标。运行应用程序。“启动可执行文件时出错...”
I changed the filename back. Same error.
我把文件名改回来了。同样的错误。
Cleaned and ran the app again and it launched.
清理并再次运行该应用程序并启动。
Renamed the app, cleaned and ran it again. Not so much luck.
重命名应用程序,清理并再次运行它。没有那么幸运。
Don't rename your app by renaming the target.
不要通过重命名目标来重命名您的应用程序。
This is such a stupid limitation. Apple lets you rename your target app, but by doing so, this prevents your app from launching on the device.
这是一个如此愚蠢的限制。Apple 允许您重命名目标应用程序,但这样做会阻止您的应用程序在设备上启动。
EDIT: I haven't checked in any code, but now I can't check out and build and run any app without this happening. How do you get the device/xCode out of this state once you've gotten it in to it?
编辑:我没有签入任何代码,但现在我无法签出并构建和运行任何应用程序而不会发生这种情况。一旦你进入它,你如何让设备/xCode 脱离这种状态?
Even the app now crashes on launch at int retVal = UIApplicationMain(argc, argv, nil, nil);
即使应用程序现在在 int retVal = UIApplicationMain(argc, argv, nil, nil); 启动时崩溃;
This is in Xcode 4.2 on Snow Leopard, but I got into the same state with Xcode 3 on another Machine last week.
这是在 Snow Leopard 上的 Xcode 4.2,但上周我在另一台机器上使用 Xcode 3 进入了相同的状态。
Edit 2: Rebooted the device, rebooted my Mac. Built and ran in the simulator first, then on the Gen4 iPod touch. It works.
编辑 2:重新启动设备,重新启动我的 Mac。首先在模拟器中构建并运行,然后在 Gen4 iPod touch 上构建和运行。有用。
回答by Kenny Winker
I had this issue when migrating a project from Xcode 4 to 4.1, and it ended up being due to the Target's "Product Name" being different in the debug and release configurations. A holdover from when I changed the name of the product many versions ago. So check that...
我在将项目从 Xcode 4 迁移到 4.1 时遇到了这个问题,最终是由于调试和发布配置中目标的“产品名称”不同。我在许多版本之前更改产品名称时的遗留物。所以检查...
回答by Surpher
I've downgraded Xcode from 4.2 to 4.1 only to encounter an error at build and run on device: "Error starting executable. Don't know how to run ...". I've cleaned the project (Xcode > Project > Clean) and cleaned the build folder (Xcode > Project > (hold option key) Clean Build Folder). After that I had to build again and it built okay on iPod touch 4g running iOS 5.
我将 Xcode 从 4.2 降级到 4.1 只是在构建和在设备上运行时遇到错误:“启动可执行文件时出错。不知道如何运行......”。我已经清理了项目(Xcode > 项目 > 清理)并清理了构建文件夹(Xcode > 项目 >(按住选项键)清理构建文件夹)。之后我不得不再次构建,它在运行 iOS 5 的 iPod touch 4g 上构建正常。
回答by Jay
Well, it sure sounds like a whole familyof bugs behind that error message!
那么,它肯定听起来像一个整体的家庭背后的错误信息的错误的!
I got the error after loading up an Xcode 3 project under 4.2.x for the first time.
None of the above tips worked for me, however what I eventually did was switching from GDB to LLDB.
我第一次在 4.2.x 下加载 Xcode 3 项目后出现错误。
上述提示均不适合我,但是我最终做的是从 GDB 切换到 LLDB。
That fixed it.
那解决了它。
It looked like the new path to the executable wasn't properly recognized by GDB (i.e. once locally at PROJECT/build/Debug/...in Xcode3 but now in the usual temp. folder location with Xcode 4 it was still looking for the executable in the build folder relative to the project sources)
看起来可执行文件的新路径没有被 GDB 正确识别(即曾经在 Xcode3中的PROJECT/build/Debug/...相对于项目源的构建文件夹中的可执行文件)
回答by Emmy
I duplicated the target and rename the copied on to different name, I got this error message. What I did is to clean the project, exit Xcode, restart the Xcode, then it can run on my device.
我复制了目标并将复制的重命名为不同的名称,我收到此错误消息。我所做的是清理项目,退出Xcode,重新启动Xcode,然后它就可以在我的设备上运行了。