Xcode 4-重新安装我删除的密钥链证书

我得到了这个错误:

CodeSign 错误: 证书标识 “ iPhone 开发者: XXX”出现更多 而不是钥匙链上的一次 协同设计工具要求只有 一。

起初我想,没有担心,我只是进入钥匙链和删除重复(旧的)一个,我这样做了。我回去,关闭 Xcode,重新打开 Xcode 和项目,同样的错误。卧槽。回到钥匙链,证书又在那里了。我删除这两个证书,重复,并通知项目加载,我删除的两个证书弹回到钥匙链。

经过多次搜索,我确保我没有在系统密钥链证书,我没有。还做了清理和重建。当我有与 Xcode 3的副本,我可以只清除重复的钥匙链,我很好。但是使用 Xcode 4,当我打开项目时,它会以某种方式重新安装它们。我甚至删除了所有。我系统里的 Cer 文件,可能就是从这里提取出来的。

有什么建议吗?

32540 次浏览

The solution was to go into organizer - under library - provisioning profiles, delete all of them and then reinstall any profiles I still needed.

Xcode 4 has a new feature "Automatic Device Provisioning". It's located in the organizer under library/provisioning profiles. If you have this enabled it will automatically download your provisioning profiles from the apple developer provisioning server and thus you get the error of having duplicates. The easiest way to fix it is to delete all provisioning profiles and press refresh for the "Automatic Device Provisioning". This will load your provisioning profiles from the server and will fix your problem.

  1. Remove all Provisioning Profiles from XCode Organizer;
  2. Remove old Developer Certificates from Keychain Access;
  3. Generate Provisioning Profiles with the correct Developer Certificate only;
  4. Download and install the new Provisioning Profiles;

-- EDIT --

Merge @Codezy's answer and @iphone007's comment.

Deleting provisioning profiles in Organizer's library, additionally, you should delete iPhone developer certificate in Keychain Access. (The certificate's name is probably like "iPhone Developer: XXXXX ..." and indicated by red X sign, as expired)

if you want to mess with keychain access to remove the expired certificate, you may try this:

  • create a new keychain, name it "expired" and move ONLY the expired certificate to it.
  • delete the newly created "expired" keychain which contains ONLY the expired certificate, when asked select "Delete references & files".

the expired certificate disappears together with the keychain. worked perfectly for me.

For posterity, here's the strategy to get around this problem in our automated build script:

  1. Before building, move the ~/Library/MobileDevices/Provisioning Profiles directory aside
  2. Check to see if the iPhone Configuration Utility is running and close it (certs always reappear if this app is open. In XCode 4.1 you need to close the organizer too.)
  3. Run you build
  4. Move the Provisioning Profiles directory back
  5. Profit?

I've tried everything suggested here but nothing worked for me except reinstaling XCode 4.3 magically solved the case.

I had this same problem and the solutions above did not solve my problem (well nearly).

I had the same duplicate developer ID/certificate that everyone is complaining about, and I tried deleting all my profiles, revoking/reissuing my cert, making sure there were none in the system keychain, restarting, etc etc.

In the end it turned out there was a certificate in the system keychain, one that had expired and so was hidden by default in the list.

Make sure you can see expired certificates in KeyChain

To do this:

  1. Open Keychain Access
  2. Click View menu
  3. Click Show Expired Certificates
  4. then look for, and delete expired developer certs

the above method not work for my case

finally , i go to keychain

and search the key by entering the name

i finally found the cert which is supposed to be deleted before . then i deleted it and the problem solved

it's really frustrating , and i don't know whether it's the bug ....... really exhausting.

I spent for this a half-day and finally found the solution

  1. Open KeyChain Access.app
  2. Select "System" in "Keychains" menu on the left part of Keychain application screen
  3. Select "Certificates" in "Category" down menu
  4. Remove all old certifications.

Then close Keychain.app and go to Xcode -> Organizer

  1. Remove all Provisioning Profiles in Library menu
  2. Remove all Provisioning Profiles in Devices menu
  3. Push "Refresh" button in Library menu -> Provisioning Profile
  4. Add needful profiles to your device

Build again your app:)

  1. Remove ~/Library/Developer/Xcode
  2. Clean Project

build...

Quoting an answer to a duplicate of this question, some of Xcode's bugs in this area can only be solved by restarting OS X.

In the end, I achieved success by deleting everything mentioned in any of the answers to this question, restarting, then manually installing the parts I needed (I did not trust/try the automatic profile/certificate download feature).

For what it's worth, @AndreasPrang, your answer worked when all of the above didn't. I could see the expired certificate was not anywhere in the keychain, yet when I did a build, Xcode said it was. Deleting the provisioning profiles (all of them), selecting my name in the Team section and clicking the refresh icon in the lower right of the organizer also did not help. Restarting Xcode didn't help, but shutting down XCode, deleting ~/Library/Developer/Xcode did. When I restarted XCode, it rebuilt everything and was happy.

The other reason that xcode keeps installing your certificate is because you did not delete key, only certificate. You need to delete private key (and corresponding public key) as well as certificate in keychain otherwise xcode will reinstall the certificate.

Check here To remove development and distribution certificates from your keychain

Just installed Xcode 4.6.1 and started having this problem again. The last time was a long time back. I deleted the old provisioning profiles and the certificates, but still could not build.

This time it turns out that I had 2 certificates listed for me in the team account of the developer portal. The first was expired, the second was not. Xcode kept grabbing the first one it found while refreshing (or maybe both).

I deleted both certificates from the keychain, then manually downloaded the good one from Apple's portal and manually added it to the keychain. Now I can build again.

(And I sent a request to the team admin to remove the old certificate.)

Figured out a really easy way to fix this in 4.6.1. You can do it without restarting anything or deleting any profiles!

With Keychain Access and your Xcode project open:

  1. In Xcode, open Organizer - "Devices" and select the "team" with the duplicate certificate.
  2. Switch to Keychain Access and delete the old duplicate certificate(s). Note: Make sure you turn on "show expired certificates" to not miss any.
  3. The certificates will have disappeared from the "team" profile in the Xcode Organizer.
  4. Clean project and build.

Hope it helps!