CodeSign error: Certificate identity 'iPhone Developer: XXXX (12345678)' appears more than once in the keychain. The codesign tool requires there only be one.
So I go to my keychain and delete it. But I get this error every time I restart Xcode 4 and some app is adding the expired old certificate back into keychain. Any ideas why and which app?
I think I figured out why the simple delete is not working. Because the dev certificate is still stored in the provision profile, when I close/re-open the Xcode after deleting the certificate in Keychain, I saw the old certificate come back. So I delete it again. It worked.
The simple delete the profile solution did not work for me.
Solution that worked in my case:
Answer is here
remove all of my old provisioning profiles using the old certificate with Organizer then quit XCode, remove the old certificate from Keychain and restart XCode.
looks like the xcode will keep certificates around when you have references to the in the provisioning profiles
It's very easy, export the correct Certificate to your desktop. Delete that Certificate in the keychain. Try to build source with error message (have no cert..) Then import again the certificate. => Success!
I just had the same problem. It has been fixed. It came after I submitted an app and installed a few certificates to sign the app.
Quick Fix: Open up KEYCHAIN ACCESS > click on MY CERTIFICATES> in there you will probably see iPhone Developer: . You will probably see it TWICE! Select the one with the earliest Expiration date, right click and select DELETE.
Restart Xcode if you haven't. Works now. :)
Happy Coding.
In my case, the "cache" Xcode was looking at was an attached iOS device. To determine if this is the problem for you:
If this is the root cause for you, you can get round it by making sure you disconnect iOS devices before starting Xcode.
Simply deleting the redundant certificate didn't work for me. It seems that every time xcodebuild is called, it is "Re-creating" the certificate in the keychain from a cache somewhere... same issue as avi I created a hack / fix for it, tried to find where the file was getting cached and clear it, but had not luck. In the end, what worked for me (a bit of a hack, but hey, what else can you do), was to figure out what the certificate number is, and manually remove it from the keychain shortly after xcodebuild is called. First, go to your /usr/bin/ directory (or whatever directory has your xcodebuild file, try
which xcodebuild
) and run the following command:Then create a file using your favorite editor (don't forget to sudo) with the following code:
Note: you'll have to modify your sudoers file to have access to run this specific command without having to enter a password.
Replace the hex identity after -Z above with the hex identity of the offending zombie certificate. Finally, make sure that the xcodebuild file is executable:
You can now open your keychain and run the build command, and watch how the offending zombie certificate is resurrected, and then summarily shotgunned prior to it becoming a problem for codesigning. Hopefully Apple will come up with a real fix for this.