Codesign error: Certificate identity appearing twice

前端 未结 15 2120
孤城傲影
孤城傲影 2020-12-07 13:04

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

相关标签:
15条回答
  • 2020-12-07 13:21

    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.

    0 讨论(0)
  • 2020-12-07 13:23

    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.

    0 讨论(0)
  • 2020-12-07 13:25

    I just deleted one of the private keys in my keychain for the certificate that I don't need any more.

    Even though the certificate re-appers but the private key doesn't reappear. Now check for the valid certificates and only one certificate will appear and the other certificates whose private key is deleted is no longer displayed under valid certificates.

    I think this is the simplest way to resolve this issue.

    0 讨论(0)
  • 2020-12-07 13:27

    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

    0 讨论(0)
  • 2020-12-07 13:33

    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.

    0 讨论(0)
  • 2020-12-07 13:34

    Ok, found the answer on another "Related" question. Xcode expired certificate problem Known issue with Xcode 4 http://openradar.appspot.com/9173280

    0 讨论(0)
提交回复
热议问题