174

I am trying to launch my app on device. It is launching successfully on the simulator.

  • List item
  • I use 7.1 SDK
  • Xcode 5
  • And the device is a 7.1 iPhone 4S

I have tried:

  • Clean
  • Clean Build Folder
  • Deleting app
  • Disconnecting/Reconnecting device
  • Booting device
  • restarting Xcode

What can I do to make it work?

Could it be something with Code Signing?

Currently i have it set to 'Dont Code Sign'

jww
  • 97,681
  • 90
  • 411
  • 885
user317706
  • 2,077
  • 3
  • 19
  • 18
  • 1
    Have you checked your provision profiles? Go to organizer and ensure that your device is green and not yellow. It will allow you to troubleshoot from there. XCode5 has major improvements over the older versions to automatically sync your provision code signing profiles. – apollosoftware.org Mar 27 '14 at 09:39
  • check this http://stackoverflow.com/questions/10087985/xcode-doesnt-see-my-ios-device-but-itunes-does – Anupam Mar 27 '14 at 09:50

24 Answers24

401

I had this problem when I used a Distribution certificate instead of Developer one when running the app from Xcode. You may check it out your target --> Build Settings --> Code signing.

As @AndyDynn pointed out in his comment: Make sure you do this on the "Target" build settings and not just the "Project" build settings.

melbic
  • 11,988
  • 5
  • 33
  • 37
  • 5
    For me, this was the provisioning profile being distribution, not the certificate. – jeremywhuff Aug 27 '14 at 22:35
  • 7
    Just make sure you do this on the "Target" build settings and not just the "Project" build settings. – AndyDunn Aug 29 '14 at 14:03
  • 5
    Just updated to Xcode 6.1 and started getting this... Neither this solution, along with the two hints above won't solve this. Tried one iPhone 5 with latest iOS 7, and one iPad with iOS 8.1. Any clues? – helmesjo Oct 27 '14 at 11:58
  • 2
    Clean, Quit iTunes and XCode, soft-reset device (long press home+power), Build and run your project on the device. – Don Park Nov 09 '14 at 16:44
  • Note: I had to do this to BOTH my product target AND my test target. – Jeremy White Dec 18 '14 at 05:19
  • This and @AndyDunn's comment above solved this for me. Might want to update the answer to include his comment. Thanks Andy. Literally hours of wasted time trying to figure this one out. – Nicholas Harlen Feb 12 '15 at 23:18
  • My code signing is already set to Developer (Target) ... still getting the error though :-/ not sure what's different here !??!? – matrix4use Mar 23 '15 at 16:23
  • I had to open it on the iPad, and then click Trust on the cert. Then I debugged again and it worked. – Kind Contributor Mar 26 '15 at 23:04
  • 1
    Can I upload app in testflight via selecting developer certificate? Cause my app runs fine until I uploded to testflight and after uploding to testflight via distribution certificate this error is going to occur. – Mrugesh Tank Apr 14 '15 at 14:11
  • I built twice in a row. The first time no problem. Second time, I got this message. I don't think it had anything to do with provisioning profiles, signing etc. All that was unchanged. Instead. I think what happened is that the app was terminated on the device but not in Xcode, which thought it still had a connection. There was probably something related to that preventing the launch. Problem was solved by disconnecting the cable from the device and reconnecting, then trying the build again. – Victor Engel Jun 28 '15 at 16:01
  • My phone was automatically reset and then it worked correctly. – Mahmut K. Sep 26 '19 at 09:51
30

I literally restarted my iPad, that was connected for testing the app, and that resolved the issue.

Kmb40
  • 2,341
  • 3
  • 18
  • 14
12

To run your app on a device, you will perform these tasks that follow:

  1. Request a development certificate.

  2. Add your device to the portal.

  3. Code sign your app.

  4. Launch your app on the device.

For more detail check this

Gajendra Rawat
  • 3,673
  • 2
  • 19
  • 36
8

If your provisioning profile and code sign everything is alright then try once Quit and Restart your XCode. It will work for me.

AlexVogel
  • 10,601
  • 10
  • 61
  • 71
Upkesh
  • 81
  • 1
  • 2
7

I just had this issue. I had to open the app on device and tap Trust Computer. No need for me to reboot everything 20 times, yay.

daihovey
  • 3,485
  • 13
  • 66
  • 110
6

Below are 2 awesome hacks that have not been mentioned yet:

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

HACK #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!

RainCast
  • 4,134
  • 7
  • 33
  • 47
4

I got the same problem and after looking at the answers here I found mine. The issue at hand was: my dev distribution certificate was gone from iOS Dev Center, so I just assume it had timed out. I didn't get a nice warning though, just the above error - installing worked but debugging didn't. So I had Xcode regenerate a new one for me.

Jonny
  • 15,955
  • 18
  • 111
  • 232
3

One more thing to try if you've tried the above: i found this link about quitting itunes to avoid the timeout. This works for me with xcode 5.1

sunilr
  • 1,146
  • 10
  • 11
1

In my case there was no value at Targets -> Build Settins ->Provisioning Profile. Though Code Signing looked ok)

Naloiko Eugene
  • 2,453
  • 1
  • 28
  • 18
1

I cleaned out my provisional profiles, rebooted the iPhone, rebooted the computer, and it worked for me.

Scuttle
  • 165
  • 3
  • 11
1

Just to throw out an additional suggestion to anyone coming across this problem (it's been burning me frequently lately) -- try going to the Targets -> (Your Target) -> General -> Team and re-selecting the same Team, which forces Xcode to update profiles for you.

That has been the culprit for me a couple of times. Seems to happen specifically if you've recently re-downloaded a distribution certificate for new devices or w/e. Or if you've just dumped your Provisioning Profiles directory in general.

shortstuffsushi
  • 2,271
  • 19
  • 33
1

I had the same problem and I tried all the suggested steps but I managed to get it deployed and run only after I powered off my iphone.

Aninom
  • 11
  • 1
1

Checked my Targets and code signing details, didn't help. I did three things:

  1. Clean Build Folder
  2. Close Xcode and delete everything in Derived Data
  3. Rebooted my device

Everything worked fine after that. I had changed some App Transport Security setting in my info.plist right before this occurred. Not sure if it is related or if only one of my 3 steps were necessary, but it worked.

knarf
  • 702
  • 1
  • 9
  • 16
  • This worked for me too. Such an annoying bug, since it builds and installs, and then the console in VS Code just says "Could not launch application on xxx iPhone"... very helpful. – Jaidyn Belbin Apr 26 '21 at 08:17
0

Make sure the Provisioning Profile setting in your environment is set to your development profile: Project > Build Settings > Code Signing

Consider setting it in your Target settings and the Pod project (in case using Cocoa Pods).

In case the development profile is not present create or download it: Certificates, Identifiers & Profiles > Provisioning Profiles

asaf am
  • 1,345
  • 15
  • 28
0

After following the above, it still didn't work (from xCode 6). But after rebooting the phone and deleting the app, it worked.

Jack BeNimble
  • 35,733
  • 41
  • 130
  • 213
0

Check Product Name for dots "." "." are not allowed in Product name.

Vlad
  • 3,465
  • 1
  • 31
  • 24
0

Selection in provisioning profiles may cause this problem. So while launching an app on to the device, make sure you are using the development profile & not the distribution profile. I have been facing the same issue. But got away with it using the same process.

Check for Project > Build Settings > Provisioning profile & select your development profile.

And also take care of Code Signing Identity in the same tab. Make sure you choose both the identities of Developer & NOT of Distribution.

0

Below two steps solved for me:

For xcode version: 7.2

  • 1.Select any of your simulator to run ( just start your run, no need to load the app completely).
  • 2.Stop it.
  • 3.Then select your device and run.

This solved in my case.

Mumthezir VP
  • 6,251
  • 6
  • 28
  • 57
0

option + command + shift + k and then run the project did the trick for me.

Chaudhry Talha
  • 7,231
  • 11
  • 67
  • 116
0

If your goal is to just launch the app and debug it, you can also edit the schema to "Wait for executable to be launched" and run the app manually. The setting is under Edit schema > Run > Info > Launch. Choose "Wait for executable to be launched" instead of "Automatically". It will wait for you to run the app (by manually tapping it) instead of timing out.

0

As all of the above answers didn't helped for me I'll publish my solution:

Deleting all the occurrences of xcuserdata folders in .xcodeproj and .xcworkspace and restarting Xcode fixed the problem. To delete it right click your_app_name.xcodeproj and/or your_app_name.xcworkspace in your app folder and select "Show Package Contents". I hope that help someone to save some time.

Hristo Atanasov
  • 1,236
  • 2
  • 18
  • 25
  • Why negative vote? This is a real solution to the same problem/error that is caused by many or different things. And no one of the other suggestions worked. – Hristo Atanasov Jun 04 '18 at 13:10
0

Just restart my Device and works everything fine

Ahtazaz
  • 903
  • 8
  • 21
-1

I tried:

  1. Restart the device (iPhone)
  2. Clean build the XCode project

Then it works.

RedR
  • 1
  • 1
  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Feb 16 '22 at 05:27
-3

Check whether the device memory is full.

chinthakad
  • 939
  • 2
  • 16
  • 31