Xcode 无法启动应用程序(无法附加)

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

Xcode could not launch app (unable to attach)

iosxcode

提问by Phan Van Linh

I am new in iOS. I update XCodeto version 7.2. And every time I edit some code then run the application the XCodewill display.

我是 iOS 新手。我更新XCode到 7.2 版。每次我编辑一些代码然后运行应用程序时XCode都会显示。

Could not launch my app (unable to attach).

无法启动我的应用程序(无法附加)。

However, when I run the app again, it will run successful.
Indeed, I can run the application but I feel uncomfortable when I face this problem every time

但是,当我再次运行该应用程序时,它会成功运行。
确实,我可以运行应用程序,但每次遇到这个问题时我都感到不舒服

enter image description here

在此处输入图片说明

Did I make something wrong? Any help would be appreciated

我做错了什么吗?任何帮助,将不胜感激

采纳答案by Roy K

You are not doing anything wrong; it happens from time to time. There is no need to clear data and restart the Mac. Just try the following:

你没有做错任何事;它不时发生。无需清除数据并重新启动 Mac。只需尝试以下操作:

  • Unplug and plug the device back in.

  • If still happens, restart Xcode.

  • 拔下并重新插入设备。

  • 如果仍然发生,请重新启动 Xcode。

回答by Roy K

Simply change your device setting go to Settings -> General -> Device Management-> Developer App -> your_provisional_profile -> and click on Trust this developer. Run the project again.You are done

只需更改您的设备设置,转到设置 -> 常规 -> 设备管理 -> 开发者应用 -> your_provisional_profile -> 并单击信任此开发者。再次运行项目,大功告成

回答by Jayprakash Dubey

This happened to me. I'm using Xcode 7.2. Sometimes building app on device/simulator fails and it prompts this error message.

这发生在我身上。我正在使用 Xcode 7.2。有时在设备/模拟器上构建应用程序失败并提示此错误消息。

Screenshot indicating error

显示错误的截图

Simply, re-run your projectand it will work correctly.

只需重新运行您的项目,它就会正常工作。

If not the quit Xcode then open app and run again.

如果不是退出 Xcode,则打开应用程序并再次运行。

回答by Anton Tropashko

This was completely screwed up in xcode 8.1, at least for extensions.

这在 xcode 8.1 中完全被搞砸了,至少对于扩展来说是这样。

I've filed 29064806 with Apple.

我已经向 Apple 提交了 29064806。

The only recorse is to fallback to a version of xcode that works.

唯一的建议是回退到一个有效的 xcode 版本。

In my case that's 8.0 (where you get this not nearly as frequently)

在我的情况下是 8.0(你得到这个的频率不那么高)

回答by rjberry

I was having this problem while using Xcode 9.2 and iOS 11.2. After much googling, the only thing that solved all of my issues was turning off "Debug executable" in my scheme. This can be found under Product > Scheme > Edit Scheme > Run (on the left menu).

我在使用 Xcode 9.2 和 iOS 11.2 时遇到了这个问题。经过多次谷歌搜索,解决我所有问题的唯一方法是在我的方案中关闭“调试可执行文件”。这可以在“产品”>“方案”>“编辑方案”>“运行”(在左侧菜单中)下找到。

Prior to this, I tried a lot of different solutions including deleting my derived data, restarting my computer, and switching the launch in my scheme to "Wait for executable to be launched" instead of "Automatically". Switching the launch setting in my scheme allowed the app to launch on my phone, but the Xcode debugger and safari debugger still would not connect to my app.

在此之前,我尝试了很多不同的解决方案,包括删除我的派生数据,重新启动我的计算机,并将我的方案中的启动切换为“等待可执行文件启动”而不是“自动”。在我的方案中切换启动设置允许应用程序在我的手机上启动,但 Xcode 调试器和 safari 调试器仍然无法连接到我的应用程序。

This is the article where I found the solution: https://exceptionshub.com/xcode-beta-error-iphone-has-denied-the-launch-request.html

这是我找到解决方案的文章:https: //exceptionshub.com/xcode-beta-error-iphone-has-denied-the-launch-request.html

回答by Dilip Bhuva

I had try this and it solve problem

我试过这个,它解决了问题

  • Un plug connected device
  • Restart device
  • 拔下连接的设备
  • 重启设备

it works for me

这个对我有用