Codesign error: Certificate identity appearing twi

2019-01-16 04:32发布

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?

15条回答
forever°为你锁心
2楼-- · 2019-01-16 04:41

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:

  1. Quit Xcode
  2. If the Keychain access is open, keep it open.
  3. Launch Xcode now.
  4. See that the certificate Xcode was complaining about will be re-added into the keychain at launch from its cache.
  5. Go ahead and delete it.
  6. Compile and happy coding.
查看更多
Root(大扎)
3楼-- · 2019-01-16 04:44

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

查看更多
We Are One
4楼-- · 2019-01-16 04:44

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!

查看更多
Bombasti
5楼-- · 2019-01-16 04:46

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.

查看更多
聊天终结者
6楼-- · 2019-01-16 04:48

In my case, the "cache" Xcode was looking at was an attached iOS device. To determine if this is the problem for you:

  1. Disconnect all iOS devices
  2. Delete offending certificate and private key from Keychain Access
  3. Restart Xcode
  4. Check Keychain Access: in my case the duplicate was NOT recreated at this point
  5. Reconnect the iOS device
  6. Restart Xcode again
  7. Check Keychain Access: in my case the duplicate was recreated at this point

If this is the root cause for you, you can get round it by making sure you disconnect iOS devices before starting Xcode.

查看更多
爷、活的狠高调
7楼-- · 2019-01-16 04:52

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:

sudo mv xcodebuild xcodebuild_actual

Then create a file using your favorite editor (don't forget to sudo) with the following code:

xcodebuild_actual $* &
echo "xcodebuild started, waiting to wipe certificate, 10 seconds"
sleep 2
echo "Wiping Certificate..."
sudo security -v delete-certificate -t -Z 407629F811D52C0BB7AD31BBB18DCB496354B05E

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:

sudo chmod 755 xcodebuild 

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.

查看更多
登录 后发表回答