开发者

XCode fails to run app on device, saying the program being debugged is not being run

I'm running Xcode, trying to get my app to run on my iphone. I'm getting the error message "the program being d开发者_如何学Pythonebugged is not being run."


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.


It only worked for me when I removed another unrelated expired provisioning profile from the device. Very weird.


All I needed to do to resolve this problem was reboot my device.


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.

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.

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.

Hope that helps, guys. -VTPete


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.


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".

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.

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.

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.

This error makes sense if the signed app is linked to the profile and it's certificate via the app id.


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.

To fix the error, just revert those modifications: replace all instances of XCCodeSignContext with XCiPhoneOSCodeSignContext in that Info.plist file.


You should check which certificate you ase using, remember to use developer provision for debug on you device and ensure all configuration is done.


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.

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.

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 not tick "iPhone Developer:" under "Automatic Profile Selector", even if it "currently matches" the same developer ID and profile

(I also quit Xcode and did rm -rf build, but that is probably not needed).


This happened to me after installing an AdHoc distributed app to my device. I had to restore the device to make the debugger work again.


I was having the same trouble and none of the above worked (even wiping / restoring the device).

Then I looked and saw that I had mistakenly set all my targets to use the adhoc distribution profile. Which doesn't support debugging.

See also iPhone Debugging: How to resolve 'failed to get the task for process'?


I just had to power off my iPhone device and restart the same.

I tried in this order:

  1. Delete app in Xcode.
  2. Delete build folder in Finder.
  3. Restart device.

Only 3. worked for me.

imp: My Provisoning profiles are valid for almost a year and there was no reason for them to expire (I even cross-checked them to be doubly sure :)). If this hadn't work, I would have checked - as someone rightly suggested, if Developer provisioning profile was being used - which was, in my case.


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.

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.


I ended up deleting my Target to fix this freakin headache. To add a new one, right-click Target > New Target > Application.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜