ChatGPT解决这个技术问题 Extra ChatGPT

Xcode: failed to get the task for process

I've run in release mode my app on a iPhone with Xcode 4.

Everything worked great until when I switch to the simulator and I switched back to the iPhone. After switching back, the app is launched on the iPhone, but the home screen is displayed immediately after and in Xcode I get:

failed to get the task for process 

I've tried to remove/add Entitlements file, delete app and restart Xcode but nothing to do.

did you tried by changing Bundle ID?

b
borrrden

I am betting that your release mode includes compiling with your distribution certificate, which disallows this behavior (you wouldn't want some random fool hooking into your app after downloading it from the app store). Compile with the development certificate instead. You can change this in the building settings under code signing.


Make sure that the correct target is selected, and that you aren't adjusting code sign settings for the test/other target.
Kind of makes you wonder why Apple wouldn't give us a more useful error like "please use a debug profile"
All my experience of developing for Apple platforms is pure pain. I don't know how can they have so little respect for themselves
Yup, I had made the same mistake: Xcode happily built, and let me attempt to run an app, where I'd chosen a Provisional Profile, with a Distribution (rather than Development) certificate. But, seriously, WHY... Why can't Xcode give a half-useful error message, to alert you to this issue ? It's 2016. Is Xcode ever going to grow up, and look like a half-decent environment ?!
@MikeGledhill It's Dec. 2020 and it's still same. xCode is not moving up.
T
Teofilo Israel Vizcaino Rodrig

Change the profile for code signing. Select your project, go to Build Settings > Code Signing Identity. Switch to other developer profile.


There are two Build Settings, one under Project and one under Targets. I had to change the code signing for both of them to work.
C
Charlie Scott-Skinner

If anyone is having this issue but is sure they have their certificates and code signing correctly set up, check the capabilities tab when you click on the project (i.e. next to build settings tab, build phases tab, etc).

In my case there were broken links for Game Center and In-App Purchases that needed fixing (by clicking the "fix me" buttons) to solve this issue.


D
DamongoCoder

I had a the same issue and after reading the above answers all I had to do was go to Build Settings > Code Signing > Provisioning Profile > None and was able to ran the app on my devices again. Hope this helps someone else out


The changes above didn't work for me either but your suggestion did.
I wasn't having any luck at all. Finally turned out I was setting the provisioning profiles for my Project. I needed to set it for the Target I was building. whew
A
Aleksander Niedziolko

To anyone who comes across this: After reading this, I attempted to solve the problem by setting the Debug signing to my Development certificate only to find that deployment was still failing.

Turns out my target was Release and therefore still signing with the distribution certificate - either go back to Debug target or change the release signing to Development temporarily.


s
saurabh

I switched back to "Automatic" on the build settings provisioning profile for "Debug" and left the release certificate profile unchanged, mine worked. Tried the other answers. nothing worked. Didn't want to have to reconfigure my certificates. Automatic on the provisioning profile did the trick

https://i.stack.imgur.com/t4cf7.png


n
nenchev

If you've set the correct code signing certificate under Build Settings->Code Signing, then make sure you are also using the correct provisioning profile for Debug/Release mode as well.

I was having this issue because I was using an Ad-Hoc provisioning profile for both Debug/Release modes, which doesn't allow for a development profile to be used when doing a debug build.


A
Alexej W.

Just get the same problem by installing my app on iPhone 5S with Distribution Profile

-> my solution was to activate Capabilities wich are set in Distribution Profile(in my case "Keychain Sharing","In-App Purchase" and "Game Center")

Hope this helps someone...


P
Pradeepta

https://i.stack.imgur.com/zBLEe.png

Edit Scheme Choose Run Uncheck “Debug executable” Clean Derived Data: ⌘ Cmd + ↑ Shift + K Run the app again: ⌘ Cmd + R


Step 3 took the magic to me.
S
Sea Coast of Tibet

Just had the same problem - app was being installed OK, but won't run from Xcode with the "process launch failed: failed to get the task for process".

Turns out my development certificate expired during the night. Regenerating the certificate and the provisioning profiles solved the problem.


Same here. You can tell there is something wrong with the dev certificate if the status of the dev provisioning profile in Organizer reads "Valid signing identity not found".
h
hawkeyecoder

Having the developer code signing id is correct for sure, but also make sure you device is added to the Member Center via organizer, or through the developer portal.

A few days ago I reset my device list, and today I was suddenly getting this for an iPod I debug with all the time. About 15 mins later I realized the problem.


t
thetrutz

I had this problem after I created a new developer certificate.

The following was already correct: The old private key was deleted from the keychain, all profiles where up to date, the build configuration and signing settings were correct. Yet I had this problem.

Solution: I had to restart Xcode (5.1.1), because it was not aware of my new developer certificate. I also deleted the obsolete profiles from my devices just to be sure and to clean up.


K
Kevin Hawker

I had this issue when trying to debug an App on a device I hadn't used before. Developer profile was correctly set. The device was part of our teams account but wasn't included in my profile.

Simply had to open Organizer -> Select the Device -> Add to Member Center


S
Sipka

I had this same problem, however in a little bit different situation. One day my application launches fine (using developer provision), then I do some minor editing to my Entitlements file, and after that it stops working. The application installed fine on my device, however every time I tried to launch it, it exited instantly (after the opening animation). (As I made edits to other files too, I did not suspect the following problem)

The problem was in the Entitlements file format, seems so that the following declarations are not the same:

Correct:

<key>get-task-allow</key>
<true/>

Incorrect:

<key>get-task-allow</key>
<true />

Altough it's an XML format, do not use spaces in the tag or the Xcode will not be able to connect to the process.

I was using developer provisioning profile all along.

Edit: Also make sure the line ending in your Entitlements file are \n (LF) instead of \r\n (CRLF). If you edit the entitlements file on Windows using CRLF line endings may cause your application to fail to launch.