lt.kraken
lt.kraken

Reputation: 1300

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:

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)

  1. Do everything what the post (marked as Solution) of nsgulliver says.
  2. 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.
  3. Make sure you have the WWDR of Apple installed to mark the certificate authority as valid.
  4. Follow the default Provisioning Assistant guidelines.

Upvotes: 6

Views: 28140

Answers (6)

Manuel Schmitzberger
Manuel Schmitzberger

Reputation: 5478

After removing all old provisioning profiles (~/Library/MobileDevice/Provisioning Profiles/) and updating xCode, the certificates can be found again.

Upvotes: 0

Alona Moiseyenko
Alona Moiseyenko

Reputation: 247

You need to lock keychain. Please see screenshot:

enter image description here

Upvotes: 1

Caleb
Caleb

Reputation: 125037

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.

Upvotes: 1

nsgulliver
nsgulliver

Reputation: 12671

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

Upvotes: 3

jamssn
jamssn

Reputation: 123

When I've had this problem in the past I've just deleted everything on my local machine and started again. So:

  1. Delete the keys associated with your developer account in Keychain access.
  2. In XCode open the 'Organizer' (window->organizer)
  3. In Devices (top menu) and Provisioning Profiles (left menu), select all of the profiles and delete them.
  4. 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.

Upvotes: 0

Jim
Jim

Reputation: 73966

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.

Upvotes: 2

Related Questions