ChatGPT解决这个技术问题 Extra ChatGPT

Xcode 9 error: "iPhone has denied the launch request"

Using Xcode beta 9 (v4), I'm trying to launch the app by clicking on the "play" button. I get a "build succeeded" but right before launching, a popup message appears in Xcode:

"iPhone has denied the launch request."

https://i.stack.imgur.com/069JN.jpg

It used to work yesterday. It does work on the simulator. I've rebooted my computer, the iPhone, uninstall the app, cleaned the build. Running out of ideas.

that's a different error tough
I was also facing this problem. It turned out that I accidently changed the scheme. It was set to Release in the Build Configuration though I was using the Developer certificate in the debug mode.
I just restarted my device
Choose Automatically manage signing solves this problem

N
Nikhlesh Bagdiya

It may be code sign issue. Make sure you're signing with developer, not distribution.


You need indeed to use an "iOS Development" provisioning profile.
Mine was manually signed and I was using an Ad-hoc provisioning for development. I wish Apple would prompt an error about this stuff at build time, but all you get is a greyed out "Inelegible" section on the drop down for a provisioning profile. If you don't check that dropdown you'll never know. And also, if you disable the debugger like mentioned above, it will work with an Ad-hoc signing. That just hides the issue, though, doesn't fix it.
[To whoever this may be helpful] I'm using Fastlane and I solved this problem by deleting iPhone Developer: <My Name> (XXXXXX) certificate in Keychain Access since it would get automatically created (don't know how nor when) by Xcode. All my errors got instantly fixed when after deleting it.
Please note that it is still possible to launch with a distribution signing by using Nastya Gorban and Rio Weber solution with Ask on Launch.
I've had this issue since Thursday last week, can't seem to resolve it. I've tried everything, updating Xcode, updating the Mac, starting a new project, deleting the iPhone Developer and let it create again, logging in/out with different users, trying a different account etc etc, any suggestions?
C
Cœur

It happens using Xcode 9.x or newer.

I tracked this problem down to the "debug executable" checkbox in the product scheme (product->scheme->edit scheme->info->debug executable checkbox). I unchecked that and this stopped happening (as well as a couple other weird issues - no output in console being one).


This works but disabled debugging. The correct fix, when happening in XCode 9.1 is to go to Apple Developer Portal and create a Developer Provisioning Profile. Then in the project settings I used this one (instead of the automatical one) to run it and it works just fine! Seems like automatic provisioning profiles management is not working as good. I had to use an AdHoc profile to upload to HockeyApp as well.
Edward B - using a manual provisioning profile does not fix the issue for me. Same error - denied launch.
Hmm, did you try Development Profile vs Distribution Profile? That's also an issue (it wasn't before with just using automatic)
I'm using a development profile - I'm new to iOS development and haven't distributed anything yet. Should I be trying a distribution profile? Surely this is a bug or bugs and isn't how this stuff is supposed to be working? Incredibly frustrating when things work one day and don't the next. Hard to debug push notifications when the simulator won't do them and you can't get your app to run on an actual device!
Yeah, I have to say is pretty common for stuff to break like this. Either Xcode, iTunesConnect or the OS itself. Gladly there's a big community and there's workarounds, but it's always frustrating. If you already have the development profile added as manual, I'm not entirely sure. If you didnt add your device UDID manually to it, you can also try that and re-generate the provisioning profile and download it, that might help. This issue is quite weird, but always good to try so you don't have to disable Debugging.
R
Rio Weber

I have a workaround: If you change the scheme to 'Ask on Launch' it works.

In Xcode top bar

Product > Scheme > Edit Scheme > 'Info' tab > Executable:  "Ask on Launch"

http://upload-images.jianshu.io/upload_images/663014-d5d182e310052664.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240

It's slightly annoying but it works.


I feel like this is only an issue in the latest version of Xcode, didn't start happening to me until I updated. (-v 9.2)
BTW, only do this AFTER you have already tried running the app the regular way. Othersie the app won't be there to "Ask" for.
Easier workaround for the same results: simply uncheck "Debug executable" from the scheme.
This doesn't fix it for me :(
B
Binshad

This issue can be resolved by unchecking Debug Executable in Edit Scheme.

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


To navigate to the above section in XCode go to menu Product > Edit Scheme (Run tab).
Beware - this disabled the debug log which can be very useful!
how does disabling the debugger help? your breakpoints will not work anymore
getting Unable to launch com.xyz.xyz
C
Cœur

After getting "denied launch request" error, do this:

Edit Scheme -> Info -> Executable -> Ask on Launch

This worked for me with adhoc profile.


Easier workaround for the same results: simply uncheck "Debug executable" from the scheme.
getting Unable to launch com.xyz.xyz now
M
Mr Rogers

The problem for me was that I was using a free developer account (simply signed in with my Apple ID). When looking at the device logs I found (bold added)

(RequestDenied); reason: "The request was denied by service delegate (SBMainWorkspace) for reason: Security ("Unable to launch {com.my.bundleID} because it has an invalid code signature, inadequate entitlements or its profile has not been explicitly trusted by the user")"

That made me realize that I needed to go into Settings -> General -> Device Management -> {My Apple ID} -> Trust

After that, everything worked as expected.

In previous versions of iOS I would encounter a dialog on my device that would tell me that this was the problem. Maybe Apple took it out for iOS 11. 🤔


This might be fixed in Xcode 9.3. I now get a better defined error dialog that tells me to accept the certificate. Yay!
Thanks for solving my problem.
A
Antonin Charvat

Simple restarting of the iPhone helped me out.


S
Shyam

For me issue was due to code signing the app with Ad hoc profile.

After changing the code signing to developer profile,from xcode settings general tab the above issue got resolved.


K
Kameshwaran Balasubramanian

I got this issue recently and I found the solution for this crazy issue. This are the Scheme Issue to fix this issue follow following steps.

Click Edit Scheme top Navigator Tab.

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

Click Info on Run menu. On Executable dropdown select "Ask on Launch" option -> Then Close and run the build once.

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

This solved my problem when I got this issue.

Apple Reference


Worked with Xcode 9.3! For me this happened when swapping from automatic to manual code signing.
c
chbrown

Got this with Xcode 9.0 while deploying to a non-simulated iPhone 6s with iOS 10.3.

I had force-quit the app right before this arose. Otherwise, nothing had changed; all the developer signing credentials was still trusted, and the app was still marked Verified in the iPhone's Settings.

The trick that fixed it was turning the iPhone off and then turning it back on again.

Looking at my logs, it appears applicationWillTerminate was triggered a while before this happened; the instance of the app that I thought I force-quit must have been some zombie process?


I ended up rebooting my phone and it launched again. Force-quit didn't help.
A
A. K.

The problem is that xcode 'times out' after certain seconds. The fix is to edit the scheme and ask xcode to 'wait' until the executable is launched.

In Edit Scheme, check 'Wait for executable to be launched' instead of 'Automatically'


N
Nikita Haiko

I attentively read all answers but they don't help me. My solution:

Go to Xcode preferences, select accounts (⌘ + ,) Select your Apple ID, choose team and click Manage Certificates In Pop up menu in bottom left corner click + button and select iOS Development, then click done and close popup Try to relaunch application, now it's should fine.


d
d0ye

It may cause with switched a wrong branch with Git, Make sure the branch you switch not too old(since it may cause code sign issue), And on the right branch if this still bothering, select the development Provisioning Profile under Signing(Debug) if u r not Automatically manage siging.


A
Anton Malyshev

Just tick "Automatically manage signing" in General -> Signing properties of the Target. It will create Development provisioning profile for you and running on the device will work.


i
iPhoneDeveloper

These simple steps helped me.

Remove your connected iPhone, iPad from the mac. Restart your device. Select "Automatically manage signing" in Xcode settings. Reconnect your iPhone, iPad.


H
HasilT

I know there are lots of answers in this thread. I've tried every one of them but none worked for me.

TLDR:

Here is the solution:

Update to xcode 11.4.1 or newer

Going through all the certificates in Keychain access I found out that all of my developer certificates has a invalid status. And, I believe that, this is the root cause of this issue. I've tried the solution here saying delete Apple Worldwide Developer Relations Intermediate Certificate and everything. But, It didn't work.

Then I came across this link. Apparently, the Apple Worldwide Developer Relations Intermediate certificate (AWDRI) is set to expire in 2023 and developer certificates or any other certificates issued after January 28, 2021 won't be using that particular AWDRI certificate. Instead of that they use a renewed certificate which is set to expire in 2030. And here comes the problem, The new renewed certificate only works in xcode versions of 11.4.1 or newer. And, I have an older version of xcode.

When I updated my xcode to latest version - 12.4 (I had to go through making space on my machine, updating macos and all) The problem went away. All my developer certificates on Keychain access are now showing valid. And, I could see two AWDRI certificates on my Keychain access one expiring on 2023 and another one in 2030.

Description from the link I shared:

The current Apple Worldwide Developer Relations Certification Intermediate Certificate (intermediate certificate) is set to expire on February 7, 2023. The renewed certificate will be used to sign new software signing certificates issued after January 28, 2021 for the Apple Developer Programs. Remaining service certificates will be updated in the future and this page will be updated to reflect additional certificate changes.

And more...

This requirement also impacts all software signing certificates generated after January 28, 2021, by developers with Personal accounts in Xcode, as well as members of the Apple Developer Program, Apple Developer Enterprise Program, and iOS University Developer Program.

The new Apple Worldwide Developer Relations Intermediate Certificate is downloaded automatically by Xcode 11.4.1 or later and is available for download on the Certificate Authority page. Confirm that the correct intermediate certificate is installed by verifying that the expiration date is set to 2030.

Also they are mentioning about an issue with older versions:

Xcode 11.4.0 and earlier may not be able to sign software using signing certificates issued by the new Apple Worldwide Developer Relations Certification Intermediate Certificate. If you’re unable to upgrade to a supporting version of macOS or Xcode on your build machine, you can build and archive your app using an earlier Xcode client and sign it for distribution using the latest release. Alternatively, you can utilize the codesign tool to sign your software using the command line.


This seems to have caused the issue for me. I'm still on Xcode 11.0 because I need to run macOS Mojave. As HasilT points out, if you can upgrade to Xcode 11.4.1 or higher that should solve the issue for you automatically. But if you can't upgrade, go to the link HasilT shared and download Apple's updated "intermediate certificate". You'll need to install it manually into your Mac's Keychain Access app. I added it to the "login" keychain in that app via File > Import Items. That fixed things for me.
C
Cœur

I face this issue on Xcode 9.1

Scenario: I checked "Connect via Network" option for device. And trying to run app to this device with USB cable attached.

Fix: Simply remove USB cable and run.


A
A.HEDDAR

I'have tried all the answers nothing worked for me, The problem is coming form Xcode itself and has nothing to do with profiles and certificate :

Product > Scheme > Edit Scheme

In Run (Section) / info (tab) [select] the Release instead of debug as Build Configuration as follow :

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

It's a regression since Xcode 10.1

Config : Xcode Version 10.1 (10B61) Iphone X / IOS 12.1.4


I have come to more or less the same conclusion. I've tried it with different accounts, have renewed all certs and literally tried all answers given to this question. The result is always the same, it just does not work. My equipment: macOS Mojave, Version 10.14.3, iPhone SE with iOS 12.1.4, Xcode 10.1 (10B61)
With this tip am able to launch the app on the iphone but it looks like the app is partially working and crash as soon as i hit some button
Everything is ok since moving to 10.14.4 (18E226)
D
Dilip Kumar

I had the same issue . Its a bug in Xcode 9.1. There is a trick to make it work for now. Lock your phone. Run the code. Xcode will ask to unlock the iPhone.


r
rockdaswift

I just cleared the profiles with the Apple Configurator, restarted the iDevice and worked again as usual.


a
alan.raceQs

It's an intermittent bug in Xcode - I just stopped and started all my devices and it magically worked (after messing about for 1/2 hour) I had upgraded MacOS overnight to 10.13.04 which obviously upset something! Xcode 9.3, iOS 11.3 watchOS 4.3


R
Rich

Let me tell you a workaround which solves my problem:

Step 1: Windows > Devices and simulator.

Step 2: Unpair device.

Step 3: Reconnect device and trust.

Step 4: Run the application. BINGO.


L
Lee Probert

For me this issue was related to a Manually installed Enterprise Certificate and having to use it for both development and release schemes. I had to trust the certificate on the device before it would allow the app to be launched, but it would never launch as I kept getting that denied message. Eventually, editing the scheme and setting it to wait for the app to be attached before debugging did the trick.


C
Cà phê đen

Open the App Groups in Capabilities, wait App... effective,then close the App Groups, it worked:

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


It worked! That thing recreating broken provisioning profile. I've just discovered that and came here to post this as an answer, but you beat me on this😄
Not sure where to find the APP Groups !
B
Brijesh Lakkad

After seeing all the solutions given across web, i finally found one and here are those:

Error occurs because of it makes Runner confused about what profile to use.

You will most often get this error, when you have added new account in profile in Xcode > Targets > Signing.

You can remove this error by just using before one Profile.

There is no need to create New Users.

or you can sign in with account you are using in Profile in your iPhone (i did this!)

Happy Days :)


a
ackh

In case this problem occurred for you a couple of days before today, 2019-Mar-20, it is very likely related to the fact that faulty code signing certificates were issued. In that case you should be able to resolve it by just recreating the code signing certificate. This SO question already has an answer that explains you how to do so.


D
Dragas

I'm not sure whether it's a fix, or just another workaround, but uninstalling the application from my device helped. I'm still not sure what caused it, but @MrRogers answer helped me figure it out.


S
Saif

For me the issue came-up because, I was using the Distribution Provisioning Profile to debug.

We cannot debug with Distribution Provisioning Profile, changing it to Development Provisioning Profile fixed the issue.

Steps: (Xcode 11.2.1)

Select Project, Under TARGETS, select the correct target. Switch to Signing & Capabilities Under Singing section, change the Provisioning Profile to Development profile or you can just check Automatically manage signing

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


M
Mohmmad S

None of the other answered worked -

Xcode 11+

Click Edit Scheme on the top Navigator Tab. Launch option choose Wait for executable to be launched

You will have to run the application on your device manually but that will keep the debugger attached as for some of the other solutions debugger get detached.

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


It works with either launch options the solution consists on disabling "Debug executable" on your Xcode build scheme.
P
PaulPaulBoBo

Today,I also meet this question.This is my way to solve. Xcode 9.0,iPhone 6s,Automatically manage signing with my account. When I select "iPhone 6s",I found that there is an logo after the iPhone 6s It's the new function of Xcode 9.0 that can run an app on the iPhone without a string connect computer(iPhone and Mac must connect the same Network). So, I try to change this kind of connect way. Open "Devices and Simulators"-> unselect "Connect via network" And then, I clean, rebuild and run my project.It works! I will be happy if this method can help you.


You got lucky. This had no effect on my "denied launch" problem. I'd rather be lucky than smart.
Good luck to you based on smart.