82
votes

I can't debug my app because when I run it, Xcode gives me the error:

Process launch failed: timed out trying to launch app

In the device I see a black screen and after the error message the app starts. How can I fix this?

I tried to change the code signing identity and the provisioning profile, and to refresh the provisioning profiles in the Xcode > Preferences > Accounts > Details tab.

I'm using Xcode Version 6.0.1 (6A317) with an iPad mini, running iOS 8.0 and a MacBook with OSX 10.9.4.

After this, if the iPad goes into sleep mode (the screen turns off) I can't wake it anymore; I have to do a soft reset.

12
For future readers who, like me, tried everything here to no avail: You may have luck by clearing the provisioning profiles from your device. To do this in Xcode 6 go to Window>Devices. Then right-click your device in the pane and open 'Show Provisioning Profiles...'. In my case, there were several repeats with varying expiry dates. Clearing out the list fixed this for me.BFar
That was it for me (profiles.) In my case, I had to delete all, re-add the right one, reboot the device, relaunch XCode, then do 2 clean builds (the 1st one still said "time out trying to launch.") Whew!Olie
None of the answers below worked for me, so I searched more and this genius idea worked: stackoverflow.com/a/28455173/1032900hyouuu

12 Answers

200
votes

You are using distribution provisioning profile rather than development profile. check this link

67
votes

How to Fix:

I fix it with:

  • clean project (Product > Clean)
  • hard reset device (power button + home button)
  • delete app from device
  • close xcode
  • CLOSE ITUNES (itunes must be closed)
  • re-open Xcode and run!

I think that iTunes was the problem.


EDIT: 2017/02: Solution still Woks (Thanks to @SalGad for information).

7
votes

I am using Xcode 6.2, running on iPhone 4 with iOS 7.1.2, the problems happen to me as well.

It turned out that the Project and Targets' Code Signing settings are different from each other! And that's what is causing the issue.

Code Signing

To solve the issue, you must make sure that their Code Signing settings is the same.

5
votes

One more thing that may be a reason to launch timeout arising is that you have a lot of Provision Profiles on your device. I have about 100 of them, downloaded automatically by XCode from our team dev portal. So if your team have tons of apps and Provision Profiles, you better unlink your XCode from your Apple ID, to prevent automatic downloading for unwanted PPs. It significantly decreases app launching time.

To delete unwanted PPs from your device you have to go XCode - Window - Devices, select your device and click "Show provision profiles..." on the bottom context menu. Then you have to manually remove the profiles. Tip: use key sequences "down arrow" - "backspace", to ease the hand routine.

4
votes

I had this but nothing previously posted seemed to work. This is what I did to fix the issue in Xcode 6.3.2:

  1. Go to Product->Scheme->Edit Scheme...
  2. Select the Run Scheme
  3. Select the Info tab
  4. Make sure the settings are as follows:
    • Build Configuration is set to "Debug"
    • Debug Executable is checked
    • Launch Automatically is checked
2
votes

In my case I was using the development profile, but somehow, in Build Settings > Code Signing, the Provisioning Profile for Debug was empty.

But before setting it to "iOS Team Provisioning Profile", I had to reset my account since it said " is Not on Any Development teams" - Xcode > Preferences > Accounts - Remove my account (click "-") - Add the account again

That fixed the problem

2
votes

Note that if the app still manages to start on the device after Xcode displays this error, you can attach to the running process with Debug->Attach to Process.

2
votes

This warning is shown when you try to run and debug your code directly in device but you are using distribution profile in your Build Settings. To directly run the code in device and debug, you need to use development profile in your Build Settings of Xcode. After setting the development profile, just reboot your device clean your Xcode project and run again. I hope this helps !!

1
votes

An app should return from his initialisation procedure in less then 10 seconds, or it will be killed by the OS. This is probably because you are doing too many things in the startup phase.

Try to refactor your code to do it diffrently, by doing lazy initialisation, and only initialize what is really important before showing the first view.

It's hard to give better advice before knowing more about the app itself

0
votes

I have faced this issue with Xcode 6.2 and Iphone 5s with iOS version 8.3.

I get this message when I deploy the application to the device for the first time.

The work around I found was that with out unintalling the application from the device,redeploy the application from Xcode.It should run perfectly this time. I observed this only on Xcode 6.2 not on Xcode 6.3 so this might be an Xcode to iOS version compatibility issue.

0
votes

Big and weird tip for this problem... this was happening to me and none of the advice helped anywhere on the web, but then i noticed if i deleted everything out of the main ViewDidLoad method it would work. I realized there was one line of code that was messing it up. It was a line that was referencing to an array of strings that was way to big. I had something like this NSString *mystring[100][1000][100]; i accidentally added some zeros and for whatever reason this problem produced the same error message that the incorrect signing gives you. So don't let your arrays or matrixes get too out of hand!

0
votes

Method #1:

Lock your phone, press XCode start, wait till XCode says "unlock your device to launch", then unlock your phone, it will be launched successfully, works every time.

Method #2:

If your goal is just to debug the app, here is another simple and straight-forward approach:

  1. After the app is deployed, launch it manually.
  2. Goto XCode -> Debug -> Attach to Process ... to choose your app from the list, then debug properly.

This works well for me, and it saves lots of time. I hope this helps, thanks!