ios Xcode 4 错误:启动可执行文件时出错

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5607154/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 19:31:37  来源:igfitidea点击:

Xcode 4 Error: Error Starting Executable

xcodeioslaunch

提问by JusmanX

I ran into problem with testing my app on iOS and Xcode when I am uploading it to my actual devices (iphone and iPad), and I'm wondering if someone knows the issue and can help me out:

当我将我的应用程序上传到我的实际设备(iphone 和 iPad)时,我在 iOS 和 Xcode 上测试我的应用程序时遇到了问题,我想知道是否有人知道这个问题并且可以帮助我:

Normally when I build my app on my devices, the app is installed and launched on my devices. But as I am preparing for submitting my first app I was testing around and changing the Bundle Identifier, App ID, and Development Provisions (so the issue may have something to do with it), and now, when I try to build my app on my devices, although it's installed on my devices fine, Xcode will not launch the app anymore. Instead, I got this error message:

通常,当我在我的设备上构建我的应用程序时,该应用程序会在我的设备上安装并启动。但是当我准备提交我的第一个应用程序时,我正在测试并更改 Bundle Identifier、App ID 和 Development Provisions(所以这个问题可能与它有关),现在,当我尝试构建我的应用程序时我的设备,虽然它安装在我的设备上很好,但 Xcode 将不再启动该应用程序。相反,我收到了以下错误消息:

Error Starting Executable. Error launching remote program: No such file or directory.

启动可执行文件时出错。错误启动远程程序:没有这样的文件或目录。

Does anyone know what the issue is? And What is this derived data folder about?

有谁知道问题是什么?这个派生数据文件夹是关于什么的?

Much thanks!

非常感谢!

回答by crazywood

I have also faced that problem. I have closed, restarted Xcode; deleted the application from device and reinstalled it again, then the problem has gone.

我也遇到过这个问题。我已经关闭,重新启动 Xcode;从设备中删除应用程序并重新安装,然后问题就消失了。

回答by Sam

Running App from a Clean Slate

从头开始运行应用程序

For me the problem did not resolve until I did the following in this order:

对我来说,直到我按以下顺序执行以下操作后,问题才解决:

  1. Delete the app from the device(Do this before trying to debug again)
  2. Quit XCode(Don't just close the project)
  3. Delete the app build folder(example path: /Users/myusername/Library/Developer/Xcode/DerivedData/MyProject-fhkaamuyvqhubaezinqbmxbnaufd/)
  4. Restart XCode
  5. Finally -- Try debugging again on the iOS device
  1. 从设备中删除应用程序(在尝试再次调试之前执行此操作)
  2. 退出 XCode (不要只是关闭项目)
  3. 删除应用构建文件夹(示例路径:/Users/myusername/Library/Developer/Xcode/DerivedData/MyProject-fhkaamuyvqhubaezinqbmxbnaufd/)
  4. 重启 XCode
  5. 最后 -- 在 iOS 设备上再次尝试调试

The app build folder of step 3 refers to your app's build folder that is a child of "DerivedData". To find this you can reveal your app in finder, then backtrack until you get to "DerivedData" folder and delete the folder above that like "MyApp-crazylongweirdletters". Without this step (3), I could not debug, so this is a critical step and you must quit XCode before you do this step.

第 3 步的应用程序构建文件夹是指您的应用程序的构建文件夹,它是“DerivedData”的子级。要找到这个,你可以在finder中显示你的应用程序,然后回溯直到你到达“DerivedData”文件夹并删除上面的文件夹,比如“MyApp-crazylongweirdletters”。没有这一步(3),我无法调试,所以这是一个关键步骤,你必须在执行这一步之前退出 XCode。

For some it appears simply restarting XCode does the trick, but not for me.

对于某些人来说,似乎只需重新启动 XCode 就可以解决问题,但对我而言则不然。

I only post this answer because the earlier answers did NOT work for me.Hopefully others banging their heads will find this and get a sigh of relief. :)

我只发布这个答案,因为之前的答案对我不起作用。希望其他撞到头的人会发现这一点并松一口气。:)

Notes:

笔记:

  • The issue started happening for me when I modified the bundle id of the app.
  • My code signing is and was correct. My provisioning profile was the "Team Provisioning Profile" which should work for any app id (default for "iPhone Developer" automatic profile selector).
  • I was doing a DEBUG build (not release / distribution).
  • 当我修改应用程序的包 ID 时,这个问题开始发生在我身上。
  • 我的代码签名是正确的。我的配置文件是“团队配置文件”,它应该适用于任何应用程序 ID(“iPhone 开发人员”自动配置文件选择器的默认设置)。
  • 我正在做一个调试构建(不是发布/分发)。

回答by Vincent Guerci

You cant debug (start from Xcode) an application signed with a distribution profile if I remember well... And then you get such messages, gdb failling to attach to process.

如果我记得很清楚,您将无法调试(从 Xcode 开始)使用分发配置文件签名的应用程序......然后您会收到这样的消息,gdb 无法附加到进程。

回答by sridvijay

I finally found my error!

我终于找到了我的错误!

I was playing around with my info.plist file, and I changed the Executable Name and Bundle and Bundle Display name! As soon as I changed those back to the Defaults (EXECUTABLE_NAME, PRODUCT_NAME, PRODUCT_NAME respectively) it worked perfectly.

我在玩我的 info.plist 文件,并更改了可执行文件名称和捆绑包和捆绑包显示名称!一旦我将它们改回默认值(分别为 EXECUTABLE_NAME、PRODUCT_NAME、PRODUCT_NAME),它就完美地工作了。

回答by Asem H.

Delete the app from the device (tap-and-hold then delete) and try again.

从设备中删除应用程序(点击并按住然后删除)并重试。

回答by Jarrod

For me, none of those worked. Same error, but different solution.

对我来说,这些都没有用。同样的错误,但不同的解决方案。

My problem was cause by me accidently changing the "Deployment Target"(ios version) to a version higher than what was on the phone I tried to run the code on.

我的问题是由于我不小心将“部署目标”(ios 版本)更改为比我尝试运行代码的手机上的版本更高的版本。

The fix was simple - drop the deployment target to below or equal to the ios software version on my phone :)

修复很简单 - 将部署目标降低到低于或等于我手机上的 ios 软件版本:)

回答by RyanJM

I got the same error by not having my code signing correct.

由于我的代码签名不正确,我得到了同样的错误。

Go to your project > Targets > Build Settings > Check code signing for debug state.

转到您的项目 > 目标 > 构建设置 > 检查调试状态的代码签名。

回答by bruce

I stumbled upon this as a solution to another issue whch was a warning when trying to build an app on a new 4.3.5 device.

我偶然发现这是另一个问题的解决方案,当尝试在新的 4.3.5 设备上构建应用程序时,这是一个警告。

If i set the profile to distribution I do not get a warning message when building the app, but the debugger will attach to the device.

如果我将配置文件设置为分发,我在构建应用程序时不会收到警告消息,但调试器将附加到设备。

If i set the code signing to the distribution profile, i get no warnings in the build process, but the debugger will not attach. So the answer above about being signing based seems to be correct. This might also only be an issue on newer 4.3.5 devices with xcode

如果我将代码签名设置为分发配置文件,则在构建过程中不会收到任何警告,但调试器不会附加。所以上面关于基于签名的答案似乎是正确的。这也可能只是在带有 xcode 的较新 4.3.5 设备上的问题

回答by Alex Zielenski

Product -> Clean in the menubar

产品 -> 菜单栏中的清洁

回答by Emad

I have the same problem. I solved it by changing the project's directory name and then launching the app again.

我也有同样的问题。我通过更改项目的目录名称然后再次启动应用程序来解决它。