XCode 无法在设备上运行应用程序,表示正在调试的程序未在运行
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1727169/
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 fails to run app on device, saying the program being debugged is not being run
提问by benvolioT
I'm running Xcode, trying to get my app to run on my iphone. I'm getting the error message "the program being debugged is not being run."
我正在运行 Xcode,试图让我的应用程序在我的 iphone 上运行。我收到错误消息“正在调试的程序没有运行。”
回答by benvolioT
The solution was to remove my developer provisioning profiles from my phone using Xcode's organizer window while my phone was connected to my computer, then to re-add my developer provisioning profile, which I re-downloaded from developer.apple.com.
解决方案是在我的手机连接到我的计算机时使用 Xcode 的管理器窗口从我的手机中删除我的开发者配置文件,然后重新添加我从 developer.apple.com 重新下载的开发者配置文件。
回答by leolobato
It only worked for me when I removed another unrelated expired provisioning profile from the device. Very weird.
当我从设备中删除另一个不相关的过期配置文件时,它只对我有用。很奇怪。
回答by SomeRandomGuy
All I needed to do to resolve this problem was reboot my device.
解决这个问题所需要做的就是重新启动我的设备。
回答by VTPete
I too have had this problem several times and I think I've just finally (after several months) wrapped my head around Apple's logic.
我也遇到过这个问题好几次了,我想我终于(几个月后)终于理解了 Apple 的逻辑。
When developing, it's very common to have to use a new provisioning profile; often because you add a new tester, or an old one expires. So, you dutifully add the new user's UDID to your provisioning profile, download it and then drag that into xcode.
在开发时,必须使用新的配置文件是很常见的;通常是因为您添加了一个新的测试仪,或者一个旧的测试仪过期了。因此,您尽职尽责地将新用户的 UDID 添加到您的配置文件中,下载它,然后将其拖到 xcode 中。
Then, you click on the settings for your project (or target) and tell it to use that new distribution profile. You probably used the "all configurations" under the "configurations" pull-down, like I did. Whoops.
然后,单击项目(或目标)的设置并告诉它使用新的分发配置文件。您可能像我一样使用了“配置”下拉菜单下的“所有配置”。哎呀。
What this does is to associate your DISTRIBUTION profile with all compile configurations. But, distribution profiles don't work with debugging! You have to make sure you don't override your DEVELOPER profile under your debug configuration. If you do that, just go back to your project, select "Debug" under configurations, and select the appropriate DEVELOPER profile to compile with.
这样做是将您的 DISTRIBUTION 配置文件与所有编译配置相关联。但是,分发配置文件不适用于调试!您必须确保没有在调试配置下覆盖您的开发人员配置文件。如果这样做,只需返回到您的项目,在配置下选择“调试”,然后选择适当的开发人员配置文件进行编译。
Hope that helps, guys. -VTPete
希望有帮助,伙计们。-VTPete
回答by Ronan
To fix this I deleted the last app which I had deployed to the app using xcode and then built my current app again and it worked fine.
为了解决这个问题,我删除了我使用 xcode 部署到该应用程序的最后一个应用程序,然后再次构建了我当前的应用程序,它运行良好。
回答by foo
For those people who are still getting this error after trying all the above, the following solution just fixed it for me after I was getting the error.
对于在尝试了上述所有方法后仍然出现此错误的人,以下解决方案只是在我收到错误后为我修复了它。
I do jailbroken development, so to bypass mandatory code signing I had modified XCode's Info.plist under /Developer/Platforms/iPhoneOS.platform.
我进行越狱开发,因此为了绕过强制代码签名,我修改了/Developer/Platforms/iPhoneOS.platform 下的 XCode Info.plist。
To fix the error, just revert those modifications: replace all instances of XCCodeSignContext with XCiPhoneOSCodeSignContext in that Info.plist file.
要修复错误,只需还原这些修改:在该 Info.plist 文件中用 XCiPhoneOSCodeSignContext 替换 XCCodeSignContext 的所有实例。
回答by Pham Hong Nghiep
You should check which certificate you ase using, remember to use developer provision for debug on you device and ensure all configuration is done.
您应该检查您使用的是哪个证书,记住在您的设备上使用开发人员配置进行调试并确保完成所有配置。
回答by Tom
The other suggestions didn't work for me either.
其他建议对我也不起作用。
It started working after I changed the "application-identifier" in the Entitlements.plist to the App Id found in the Provisioning Profile. The default was $(AppIdentifierPrefix)$(CFBundleIdentifier) which I changed to "H2GC99UNHN.au.com.mydomain.myappname".
在我将 Entitlements.plist 中的“application-identifier”更改为 Provisioning Profile 中的 App Id 后,它开始工作。默认值为 $(AppIdentifierPrefix)$(CFBundleIdentifier),我将其更改为“H2GC99UNHN.au.com.mydomain.myappname”。
The Xcode default: $(AppIdentifierPrefix)$(CFBundleIdentifier) would work if those variables resolved correctly. CFBundleIdentifier refers to the "Bundle identifier" in your Info.plist. I never found out where to set the AppIdentifierPrefix which should be something like H2GC99UNHN.
Xcode 默认值: $(AppIdentifierPrefix)$(CFBundleIdentifier) 如果这些变量解析正确,就会起作用。CFBundleIdentifier 指的是 Info.plist 中的“Bundle identifier”。我从来没有找到在哪里设置 AppIdentifierPrefix 应该是类似 H2GC99UNHN 的东西。
To find your App ID in Xcode go to the Window menu, then Organizer. Click on the correct Ad Hoc provisioning profile, the App Identifier is one of the properties.
要在 Xcode 中找到您的 App ID,请转到“窗口”菜单,然后转到“管理器”。单击正确的 Ad Hoc 配置文件,应用标识符是属性之一。
PS: To get the app on my device for testing I am using "Build and Run" in Xcode (I don't know any better). But the run part will fail because I have removed debugging symbols in my Beta configuration. Just let the run part fail and then reopen the app manually.
PS:为了让我的设备上的应用程序进行测试,我在 Xcode 中使用了“构建和运行”(我不知道更好)。但是运行部分会失败,因为我在 Beta 配置中删除了调试符号。只需让运行部分失败,然后手动重新打开应用程序。
This error makes sense if the signed app is linked to the profile and it's certificate via the app id.
如果签名的应用程序通过应用程序 ID 链接到配置文件和证书,则此错误是有意义的。
回答by Binks
I have two developer identities (work and home) and use the same device for development. I also use a wildcard app identifier (xxxxxxxxxx.*) at home, and I often build different apps using the same profile. Sometimes when I switch locations (e.g. from work to home) I get the above error.
我有两个开发人员身份(工作和家庭)并使用相同的设备进行开发。我也在家里使用通配符应用程序标识符 (xxxxxxxxxx.*),我经常使用相同的配置文件构建不同的应用程序。有时当我切换位置(例如从工作到家)时,我会收到上述错误。
Removing and re-adding the developer profiles from the device, reloading the profile from Apple and restarting the device (in various combinations) did not solve the issue for me.
从设备中删除并重新添加开发人员配置文件,从 Apple 重新加载配置文件并重新启动设备(以各种组合方式)并没有解决我的问题。
What did enable running and debugging on the device again was:
再次在设备上启用运行和调试的是:
- go to project settings in Xcode (double-click project name)
- search for "identity" to find the setting "Code Signing Identity" / "Any iOS"
- tick "iPhone Developer: My Name (mydevid)" under the section for my home profile (for Application Identifiers '*')
- do nottick "iPhone Developer:" under "Automatic Profile Selector", even if it "currently matches" the same developer ID and profile
- 转到 Xcode 中的项目设置(双击项目名称)
- 搜索“身份”以找到设置“代码签名身份”/“任何 iOS”
- 在我的家庭资料部分下勾选“iPhone 开发者:我的名字(mydevid)”(对于应用程序标识符“*”)
- 不要不勾选“iPhone开发人员:”“自动配置文件选择”下,即使“目前符合”相同的开发者ID和配置文件
(I also quit Xcode and did rm -rf build
, but that is probably not needed).
(我也退出了 Xcode 并做了rm -rf build
,但这可能不是必需的)。
回答by IgorD
Ah, latest version: I have Core-Plot framework included in my project. My old development profile expired and I dowloaded new profile, changed the project with the latest profile, but I had this error anyway.
啊,最新版本:我的项目中包含 Core-Plot 框架。我的旧开发配置文件过期了,我下载了新配置文件,用最新的配置文件更改了项目,但无论如何我都遇到了这个错误。
So, I needed to open Core-Plot framework project itself, change code signing there to latest profile, build it, go back to my original project, rebuild it and then everything started working fine again.
所以,我需要打开 Core-Plot 框架项目本身,将那里的代码签名更改为最新的配置文件,构建它,返回到我的原始项目,重建它,然后一切又开始正常工作。