Xcode does not detect new Apple Distribution Certificate in the keychain

app-store-connectcertificatexcode

I generated a new Apple Distribution Certificate for my React Native project because I got an email saying my old one was going to expire. It appears to be in my keychain:

enter image description here

but when I try to upload my app to the app store, it shows this error:

enter image description here

and when I click Manage Certificates it shows this:

enter image description here

What I Want To Know: How do I make sure that my new certificate is in my keychain such that Xcode detects it and doesn't show this error?

Best Answer

You need to obtain the private key for the certificate before you can use it for signing with Xcode.

When using Keychain, the private key is generated on the computer that was initially used for creating the certificate signing request (CSR) that is sent to Apple in order to obtain the certificate.

You need to copy the private key from that computer to your current computer in order to be able to use the certificate with Xcode.