Can't run Xcode project on device due to certificate issues
Asked Answered
E

1

1

This is the first question I've ever posted.

I am trying to run an Xcode 9.0.1 project on an iPhone 6 Plus and these three errors come up:

  • Code Signing Error: The user name or passphrase you entered is not correct.

  • Code Signing Error: No signing certificate "iOS Development" found: No "iOS Development" signing certificate matching team ID "KP3X78QM3M" with a private key was found.

  • Code Signing Error: Code signing is required for product type 'Application' in SDK 'iOS 11.0'

I suspect this is caused by Xcode not being able to read the developer certificates on my computer. This is what the General tab looks like under Signing. Clicking "Try Again" will generate a new certificate but all of the errors still remain.

I checked the Keychain Access application and it has an iPhone developer certificate, although I'm not sure if anything else is missing.

I've looked up similar questions and started reading Apple's Xcode troubleshooting guide but I am still confused and don't want to accidentally modify anything important.

I desperately need to fix this issue; if there is an Apple support email or someone I can contact in person about this, that would be amazing.

Thanks in advance!

Enlistment answered 23/10, 2017 at 4:19 Comment(8)
Did you try to delete the account and add again? From Xcode Preferences -> AccountsGlynn
Thanks for your reply. I have tried doing so on the Preferences -> Accounts page but the errors remainEnlistment
Are you still seeing invalid username or passphrase? Then try to quit your Xcode and launch again.Glynn
Unfortunately yes. If I click on Manage Certificates, there are a bunch listed that all say Missing Private KeyEnlistment
If you give the correct apple id and password and enable the automatic signing is on, then Xcode will automatically generate the certificates and provisioning profile for your app. So, try to resolve the incorrect username and password, then your issue would be resolved.Glynn
Apple ID and password are correct, and automatic signing is checked. I'm not sure what Xcode is referring to when it says "The user name or passphrase you entered is not correct."Enlistment
@ImadAli Hi Imad, I found a solution to the problem! Thank you very much for taking your time to reply.Enlistment
@Micheal good to know.Glynn
E
7

I found a solution!

Even though this question only has a few views, I'll share it in case anyone else has the same problem in the future.

Long story short, I Quit Xcode while the two errors were still present in the Signing section of the General tab. At this point, clicking Preferences -> Accounts -> Manage Certificates still gave the "Missing Private Key" error messages like so.

After quitting Xcode I restarted the computer and opened Xcode again. Under the Signing section for the General tab, it prompted me to log in with my Apple ID. After logging in, the two errors were gone. I opened the "Keychain Access" application on the mac, clicked on the "My Certificates" tab and noticed that a new certificate had been generated WITH a drop down arrow that contained a new private key!

To set up the new key so it works, connect your device (in my case an iPhone 6 plus) to your mac and run your Xcode project on the device. A window titled 'codesign wants access key "access" in your keychain." should pop up, wanting the password for your computer.

VERY IMPORTANT: Type your computer login password (not your Apple ID password) and click ALWAYS ALLOW! I got confused and accidentally hit "Deny" the first time around which is what got me into this mess in the first place. Click "ALWAYS ALLOW"!!!

After this point, Xcode should be able to run your app on a device.

Good luck!

Enlistment answered 23/10, 2017 at 9:10 Comment(1)
You don't mention, but to see the 'Codesign wants access key' window again, just restart your computer. ThanksBlastoff

© 2022 - 2024 — McMap. All rights reserved.