283

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.

shim
  • 9,289
  • 12
  • 69
  • 108
aneuryzm
  • 63,052
  • 100
  • 273
  • 488

14 Answers14

727

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.

borrrden
  • 33,256
  • 8
  • 74
  • 109
  • Ok, now I feel dumb ... I mistakenly was choosing Deployment -> iPad and was getting this error. Couldn't figure out why for the life of me, until I realized it, switched it to Development -> iPad and it worked. Duh! :P – Joel Martinez Feb 14 '13 at 16:08
  • i'm given this error also, though I have set my code signing correctly. Any advice? – esreli Mar 16 '13 at 22:40
  • 1
    Took a restart of XCode (5) for me, until it worked. – scrrr Feb 27 '14 at 15:49
  • 1
    @Tokn I think Apple would be forced to have better documentation if SO didn't exist, that's for sure. – braden May 12 '14 at 17:00
  • 3
    Make sure that the correct target is selected, and that you aren't adjusting code sign settings for the test/other target. – Vincil Bishop Jan 12 '15 at 16:41
  • 24
    Kind of makes you wonder why Apple wouldn't give us a more useful error like "please use a debug profile" – inorganik Nov 10 '15 at 15:28
  • @inorganik I bet it is because this error is not limited to this situation. Though they could add a note to check your profile. – borrrden Nov 10 '15 at 16:25
  • 15
    All my experience of developing for Apple platforms is pure pain. I don't know how can they have so little respect for themselves – noncom Nov 19 '15 at 17:46
  • But if both DEBUG and RELEASE builds are set to development provisioning profile - with which one to release the app? Or should I switch all the time the provisioning profiles in the build settings? – Darko Mar 11 '16 at 19:06
  • @Darko Switch them as needed. You can only release the app with a distribution profile, but you can only debug with a development profile. – borrrden Mar 11 '16 at 22:59
  • I have seen projects with an additional build config: DEBUG, RELEASE and DISTRIBUTION. But this is problematic with CocoaPods. – Darko Mar 12 '16 at 13:26
  • 2
    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 ?! – Mike Gledhill Jul 28 '16 at 13:25
  • 7
    @MikeGledhill It's Dec. 2020 and it's still same. xCode is not moving up. – Renascent Dec 14 '20 at 07:06
26

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. – Stephen Horvath Jul 31 '16 at 13:03
11

enter image description here I had this error while running from Xcode

  1. Edit Scheme

  2. Choose Runenter image description here

  3. Uncheck “Debug executable”

  4. Clean Derived Data: ⌘ Cmd + ↑ Shift + K

  5. Run the app again: ⌘ Cmd + R

Pradeepta
  • 268
  • 2
  • 3
7

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.

5

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

DamongoCoder
  • 431
  • 5
  • 7
  • The changes above didn't work for me either but your suggestion did. – Praxiteles May 24 '14 at 01:49
  • 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* – Suz Oct 27 '14 at 23:22
5

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.

nenchev
  • 1,998
  • 28
  • 16
5

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

screenshot

saurabh
  • 6,687
  • 7
  • 42
  • 63
4

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.

2

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

Alexej W.
  • 31
  • 4
1

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.

Sea Coast of Tibet
  • 5,055
  • 3
  • 26
  • 37
  • 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". – Vladimir Grigorov Sep 03 '14 at 09:03
0

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.

hawkeyecoder
  • 571
  • 4
  • 10
0

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.

thetrutz
  • 1,395
  • 13
  • 12
0

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

0

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.

Sipka
  • 2,291
  • 2
  • 27
  • 30