missing private key in jos distribution want to - ios

I want to upload project to testflight, I can't upload the app have this problem
this is keychain:
I've exported the two selected items and open the exported certificate again with key chain, and I've downloaded the certificate in apple developer account and open it in key chain, but it still have the same problem, I've seen many answers and I tried them but no one solved my problem, so what is the solution with my problem?

Related

Newly generated Apple Distribution Certificate in XCode is saying private key not installed

About a week ago our Apple Distribution Certificate expired. XCode detected this the next time I tried to send an app to Apple, and offered to generate a new certificate.
This process works correctly and the certificate is generated. However, when we try to use it to send the app to Apple, we receive a message saying that the private key is not in our Keychain. As this is a newly generated certificate, the private key is generated at the same time (I exported it) and I have tried installing it manually into the keychain on both 'login' and 'system' but nothing seems to work.
I have checked Distribution certificate / private key not installed and tried some of their suggestions:
Logging into developer.apple.com and revoking all old distribution certificates
Removing old certificates from Preferences -> Accounts -> Manage Certificates (I've also tried clicking the '+' icon and generating a new distribution certificate - this gets added underneath the earlier one)
Restarting XCode and the apple machine
Deleting older private keys in case they are interfering.
Is there something I'm missing? A lot of the guides seemed to suggest that generating a new certificate would be the way to go, but it just doesn't seem to 'link' with the private key it generates at the same time.
Many thanks.
EDIT: I am not alone in this it seems: https://developer.apple.com/forums/thread/671484
Just in case anyone sees this in the future, I managed to resolve the issue by manually signing the app as I'm sending it to Apple.
After lots of investigation, I realised for some reason that XCode was creating two versions of the new Distribution Certificate, one that has the private key and one without. When attempting to send to Apple, it was defaulting to the version without the private key. I switched the signing to manual (and downloaded a manual provisioning profile) so that I could select the correct Distribution Certificate that has the private key installed.

Has 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

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 from 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. Does it appear 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.
This is the image of Xcode signing certificates
Xcode signing certificates:
App distribution while uploading on App Store:
I had the same problem and after a frustrating afternoon I got round it using manual signing as per a post I found over on the apple forums. When manually signing I chose to use the existing iOS dist cert instead. Not tried with the apple dist cert that auto signing was trying to use.
iOS Distribution: Missing Private Key
Mine too is an app that's only ever been distributed from this Mac. The first hint of trouble was a message saying there was no distribution certificate so I accepted when Xcode offered to create one. After that it was just as you showed in your screenshots .. one greyed out, one looks ok. Private key is listed in Keychain Access but still get the message in Xcode when trying an ad-hoc build on Mojave, Xcode 11.3.1.

Apple distribution certificate missing private key

I know this has been asked multiple times and I have went through several stackoverflow answers and Apple dev forums and followed all the given advice but this is not working for me. I keep getting this error.
I have revoked certificates, created new ones, deleted everything in my keychain associated with the account. Generated new private keys and distribution certificates. Nothing I tried has worked. I even contacted Apple directly and their instructions did not work as well. What am I doing wrong? I have been attempting to solve this for over a month now.
These are the things I have done so far:
Revoke Existing Distribution Certificate
Delete Signing Certificate
Followed the answers given in this thread
Export the certificate from the keychain (keeping the folder open showing the private key) of the device on which the certificate was download the exported .p12 and verify if the private key is showing on the keychain if not the recently added certificate from key chain , Go to > My Certificates and drag and drop the .p12
This resolved my issue.

Xcode Code Sign error because of no Keys in Keychain

You might think, not again such a question where are already thousands of topics about. However, I've not been capable of finding the answer I needed to fix this problem.
None of these topics go as deep as the Keychain.
When I'm trying to deploy my app to an iPhone, I'm receiving the following message:
Code Sign error: The identity 'iPhone Developer: [Name] ([ID])' doesn't match any valid, non-expired certificate/private key pair in your keychains.
Now, as said, I have been looking for multiple guides or fixes, however, none of them seemed to fix this issue.
Things I've tried:
Use Apple's walkthrough for app deployment for countless of times
Searched the internet for guides for app deployment
Changed the content of the 'pbxproj' file inside the 'xcodeproj' package.
Retrieve all available profiles from Apple's server using the Refresh button in Xcode 4.6 (allows you to obtain automatically)
After trying all of these ways, I've still not been able to solve the issue. One problem I've seen is that at first hand, the certificate in the Keychain was showing an invalid status, which is now solved.
However, if I'm right, there are supposed to be two keys attached to the certificate. A public and private key, and these are not showing.
Neither are there any keys showing in the Keys tab in the Keychain Access.
Solution
(Thanks to nsgulliver)
Do everything what the post (marked as Solution) of nsgulliver says.
If you already have an active Certificate, click the Revoke button, this won't cause any trouble, you'll simply have to re-create the keys of which then will be generated a new certificate.
Make sure you have the WWDR of Apple installed to mark the certificate authority as valid.
Follow the default Provisioning Assistant guidelines.
Provisioning profiles installed on the devices or signed with for the target might not be valid, try to go to Organizer->Provisioning profile and see if the profiles have the valid status? if not try to delete & refresh them, if they appear valid after refreshing then it might solve your problem if not then you should remove all the entries from keychain and delete profiles on your provisioning portal and try to create from scratch, if you still face the problem then take help from step by step guide tutorial
You cannot re-create matching keys, that would defeat the whole purpose of them. You need to find the old keys or start the signing procedure from scratch.
Are you using the same machine that you generated the keys on? If not, go to the other machine, export the developer profile, then import it on the new machine.
Can you restore the keys from backups? If not, stop everything you are doing and configure your computer for backups before you do anything else.
If you are really stuck, you will have to follow the signing procedure right from the very beginning, where you request a certificate from a certificate authority. This will generate new keys, and you will have to create matching provisioning profiles, then set your application to be signed with these. Dlete the old provisioning profiles, they will be useless without the old keys.
You need to lock keychain. Please see screenshot:
Required reading when you're having code signing problems:
Technical Note TN2250: iOS Code Signing Troubleshooting
Nothing will help you more than really understanding what's in your certificates and what isn't, where the necessary pieces are kept, and how they're used. This isn't the last time that you'll have code signing issues, and this tech note provides a long checklist that should help you make sure that everything is in the right place to help you develop your app and ultimately sign and submit it to the app store.
When I've had this problem in the past I've just deleted everything on my local machine and started again. So:
Delete the keys associated with your developer account in Keychain access.
In XCode open the 'Organizer' (window->organizer)
In Devices (top menu) and Provisioning Profiles (left menu), select all of the profiles and delete them.
Now hit refresh. It will ask you to sign in and whether you want to generate new keys etc, select yes and wait.
I find that this is the quickest way to fix any provisioning / key problems, as you can spend hours finding that you've missed something small.
After removing all old provisioning profiles (~/Library/MobileDevice/Provisioning Profiles/) and updating xCode, the certificates can be found again.

Accidentally deleted the keys in my KeyChain Access and now can't put new ones in

I accidentally deleted the keys in my Keychain Access on my local computer which I use to archive the code when I am ready to submit a new binary.
What I am trying to do to fix this is to go to my IOS PROVISIONING PORTAL, and click on the certificated nav item on the left, and download the dev and production certificates. I do download them, and then drag them to the KeyChain icon, but I am not sure that is doing anything.
And when I try to archive the code, I get this error:
Code Sign error: The identity 'iPhone Distribution: dist_name' doesn't match any valid, non-expired certificate/private key pair in your keychains
Any idea why this is happening and how to fix it?
EDIT:
When I tried to revoke my production certificate, the system said that if I do that, my current live app will no longer work.
There are countless posts regarding this on S.O. already.
When this happens, your best bet is to begin from SCRATCH. Delete all provisioning profiles and re-do the whole procedure.
Else, you'll be stuck for hours trying to solve problems that may or may not be yours.
I had the same issue and had a simple fix
The distribution key and certificate were missing
I was able to download the certificate but couldn't get the key
Asked my team member to export his distribution cert and key.
To do that select the key or cert and export(keychain accesses-> file ->export items-> save on disc).
You will be prompted for the password, remember the password as you need it to extract the files.the files will be saved with extension .p12.
Send the .p12 file to other mac where it needs to be installed
fixed!!

Resources