iOS Distribution: Missing Private Key

Trying to submit my app to TestFlight. I am getting stuck with a missing private key error. What's weird is that the private key does exist. I can see it in KeyChain. I've only ever used one Mac for development, so it's not like I need to get it form another machine.

I tried revoking the cert, and deleting all the Apple Distribution certs/keys from my Keychain. Then I went through the Distribute App process again. Xcode offered to generate a distribution cert for me. I did that. It appears to have created two of them? One looks normal, but the second one is grayed out and says "Not in keychain".

The "missing private key" error says I have one Apple Distribution certificate but its private key is not installed. Contact the creator of this certificate to get a copy of the private key.

I've looked at a bunch of discussion posts and StackOverflow posts about this, but nothing seems to apply to my specific issue. At least, I tried all those techniques and nothing seems to work.

How do I get around this?
Answering myself, but I was able to get around this by manual signing. I don't know why the automatic signing process is failing, but there it is.
Automatic signing broken for me as well, Xcode 11.4
After a few frustrating hours, I found I had to install apples latest WWDR certificate: https://www.apple.com/certificateauthority/AppleWWDRCAG3.cer

Automatic signing still is not working, but at least with this I can now manually sign.
I've had this exact problem for the past 3 days with Xcode 10, going around in circles with automatic signing :( wish I had seen your post sooner!!

Can you expand on how you manually signed your application? Did you create and download a provisioning profile or use the latest WWDR certificate?

I've been trying to create a profile for the past hour, but it keeps complaining that there it does not include the selected signing certificate - which is definitely in my keychain.

Appreciate any insights you might have!

@orks I installed the WWDR certificate in the link. Then I went into Xcode and created a certificate with automatic signing. That doesn't work because it says it can't find the private key, so I went back to previous screen and selected manual signing and chose the same certificate and it works. I had to do the same thing again today for a different app.

Make sure that your provisioning profile is updated with the new certificate as well, you can update the profile in the apple developer console.
What version of XCode are you running?

I've been switching between automatic and manual signing but each is complaining in the same way. I'm on XCode 10 and have got xcode to create the distribution certificate afresh but it complains that the private key isn't installed for some reason. When I go to my keychain though I can see the cert and linked private key.

Under Manage Certificates in XCode I have a weird table with 2 rows:
____Certificate _____| _____Creator _____| ____ Date Created ____ |____ Status _____________|
iOS Distribution ____| DeveloperName __|_______Today___________ | ____Not in Keychain ____| (This row is greyed out)
iOS Distribution ____| ___________________|_______Today __________ | __________________________|
I'm on XCode 11.4

When you open your keychain and look at the certificate, does it say it's valid? Mine was not saying it was valid until I installed the WWDR certificate above.

What you are seeing in XCode is the same thing I was seeing when trying automatic signing. The cert was showing up twice and one was greyed out.
Yep, it says the certificate is valid and I can see the linked private key. I created it fresh this evening to try again :)

I've installed the WWDR certificate but not sure it's helping at all unfortunately.

The documentation about using WWDR on an older version of XCode is lacking a bit of detail IMO :(


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.


I think either the WWDR is working because your cert is now valid or you didn't need it to begin with.

The issues with signing might just be related to your version of XCode, it sounds like you're doing everything I had to do. Sorry I couldn't help more, hopefully apple addresses this issue.
Hey nuked,

Thanks for your quick replies and suggestions.

I've been hitting my head on this issue for the past few days but only really been looking at the manual signing once clicking Distribute App after having created an Archive.

Have just been playing with the Build Settings in XCode and settings section; I assume that I have had it wrongly set to code sign as iOS Developer. I changed that to iOS Distribution and set up the provisioning profile information there and re-archived.

This now gets me passed the signing stage when I attempt to go through to Distribute App :)

Ironically, as it's trying to upload Apple then complains as XCode 10 must be using SDK 12 which is unsupported as of June 2020.....so looks like I need to update my OS and XCode - oh joy!!!

Long and short of it:

I think the certificate issues was due to having had the Code Signing Identity field incorrectly set to iOS Developer rather than iOS Distribution and so when uploading a distribution version the app wasn't signed against the correct cert or something along those lines. Makes sense - just the error wasn't very clear.

Thanks for your help/input!
iOS Distribution: Missing Private Key
 
 
Q