xcode 代码签名错误:证书身份“iPhone 开发者:我的名字 (xxx)”在钥匙串中出现不止一次

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9359239/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 23:22:02  来源:igfitidea点击:

Code Sign error: Certificate identity 'iPhone Developer: My Name (xxx)' appears more than once in the keychain

iphoneiosxcodecode-signingxcode4.3

提问by Nico AD

I m stuck with this error:

我被这个错误困住了:

Code Sign error: Certificate identity 'iPhone Developer: My Name (xxx)' appears more than once in the keychain. The codesign tool requires there only be one.

代码签名错误:证书身份“iPhone 开发者:我的名字 (xxx)”在钥匙串中出现不止一次。协同设计工具只需要一个。

I try to renew the build a new CSR, remove the old certificate, build a new one, again and again and again and this error is still present

我尝试更新构建一个新的 CSR,删除旧证书,构建一个新证书,一次又一次,这个错误仍然存​​在

in the keychain I dont see any duplicated certificate and if I remove the only one I can see in the keychain , Xcode complains that the certificate can't be found ...

在钥匙串中,我没有看到任何重复的证书,如果我删除钥匙串中唯一可以看到的证书,Xcode 会抱怨找不到证书......

采纳答案by Bobjt

Xcode 4.3 now searches all keychains for signing certificates but that is increasing the frequency of the build error:

Xcode 4.3 现在搜索所有钥匙串以获取签名证书,但这会增加构建错误的频率:

Certificate identity (x) appears more than once in the keychain...

证书身份 (x) 在钥匙串中出现不止一次...

Apple's steps to resolve it are here: "How do I resolve the CodeSign error: Certificate identity appears more than once in the keychain?"

Apple 解决此问题的步骤如下:“如何解决 CodeSign 错误:证书身份在钥匙串中出现多次?

However,if you are affected by the keychain bug mentioned in the final note of that guide, following is a simpler and preferredsolution to problem:

但是,如果您受到该指南最后说明中提到的钥匙串错误的影响,以下是一个更简单且首选的问题解决方案:

1) Keychain Access > Edit > Keychain List, uncheck "Shared" for the login keychain.

1)钥匙串访问>编辑>钥匙串列表,取消选中登录钥匙串的“共享”。

2) next, IF going back into the Keychain List you find the login keychain is still marked as Shared, create a backup of the following files and then remove them if they exist:

2)接下来,如果返回钥匙串列表,您发现登录钥匙串仍标记为共享,请创建以下文件的备份,然后将其删除(如果存在):

/Library/Preferences/com.apple.security-common.plist
~/Library/Preferences/com.apple.security.plist

3) Retry your build.

3) 重试您的构建。

回答by Hadrien Pezier

I've had the same issue after updating XCode to 4.3. Deleting certificates and provisioning profiles didn't change anything. There were no duplicates or expired ones anyway.

将 XCode 更新到 4.3 后,我遇到了同样的问题。删除证书和配置文件没有任何改变。反正没有重复或过期的。

It turned out the problem was that my private key was in both the session and the system keychains in the keychain access. I just had to remove it from the system keychain and i could build my projects again.

结果发现问题是我的私钥在钥匙串访问中的会话和系统钥匙串中。我只需要从系统钥匙串中删除它,我就可以再次构建我的项目。

回答by TurboManolo

I've had the same issue and I fixed it deleting every certificate from my keychain, every provisioning from my Xcode and every provisioning profile from my device and later... redone it again. I guess, It normally happens when you are working with differents profiles and you have created many certificates for the same provisioning.

我遇到了同样的问题,我修复了它,删除了我的钥匙串中的每个证书、我的 Xcode 中的每个配置以及我的设备中的每个配置文件,然后……再次重做。我猜,当您使用不同的配置文件并且为相同的配置创建了许多证书时,通常会发生这种情况。

回答by elaydin

I've had the same issue as well. I think you can get to this state in a variety of ways, but for me, it was because a certificate had recently expired.
What I didn't realize was that Keychain Access will hide expired certificates. Go under "View" and make sure you're not hiding the duplicate certificate.

我也有同样的问题。我想你可以通过多种方式进入这种状态,但对我来说,这是因为最近有一个证书过期了。
我没有意识到钥匙串访问会隐藏过期的证书。转到“查看”并确保您没有隐藏重复的证书。

回答by matthisb

If you already deleted all other Developer Certificates in your KeyChain and the Error is still coming up, then try to delete all old/unused keys (private key) with your name. The one that's necessary, is the one with the little "folder-enhancer-icon" next to its name. Keeping this and deleting the rest fixed it for me.

如果您已经删除了 KeyChain 中的所有其他开发人员证书并且错误仍然出现,请尝试删除所有带有您姓名的旧/未使用的密钥(私钥)。必要的是名称旁边带有小“文件夹增强器图标”的那个。保留这一点并删除其余部分为我修复了它。

回答by JanB

After moving to a new development mac, I had this problem. I tried deleting the duplicates and checking that there were no hidden expired ones, but the error persisted. The solution that worked for me was to copy the keychain pair from the old mac and imported it in the new mac. The problem was then solved with the following:

搬到新的开发mac后,我遇到了这个问题。我尝试删除重复项并检查是否没有隐藏的过期项,但错误仍然存​​在。对我有用的解决方案是从旧 mac 复制钥匙串对并将其导入新 mac。然后通过以下方式解决了问题:

  • select the certificate in Keychain Access
  • Expand the arrow to see the private key
  • Double click the private key
  • Click Access Control
  • Choose 'Allow all applications to use this item'
  • Click Save Changes
  • 在钥匙串访问中选择证书
  • 展开箭头查看私钥
  • 双击私钥
  • 单击访问控制
  • 选择“允许所有应用程序使用此项目”
  • 单击保存更改

For me, I was then able to rebuild the app successfully.

对我来说,我能够成功地重建应用程序。

Hope that helps someone :-)

希望对某人有所帮助:-)

回答by Jonny

This works sometimes for me:

这有时对我有用:

  • Delete all duplicates that you can see from the keychain (normally this step on itself does not help me)
  • Then also delete (or at least temporarily rename/move ~/Library/Developer/Xcode folder. Xcode keeps old crap/cache in there. I guess profiles exist there. Waste em. (Note that the path of this folder is changeable in Xcode prefs so if you changed the path, go there and delete stuff instead.)
  • 删除您可以从钥匙串中看到的所有重复项(通常这一步本身对我没有帮助)
  • 然后也删除(或至少暂时重命名/移动 ~/Library/Developer/Xcode 文件夹。Xcode 将旧的垃圾/缓存保留在那里。我猜那里存在配置文件。浪费它们。(请注意,此文件夹的路径在 Xcode 中是可更改的) prefs 所以如果你改变了路径,去那里删除一些东西。)

Then rebuild. Worked for me this minute after getting this error the millionth time.

然后重建。在第一百万次收到此错误后,这一分钟对我来说有效。

回答by Shane Rayner

I had the same problem. I checked every related question I could find on SO and followed the steps - but had no luck. It kept telling me that my distribution cert appeared more than once, but I could see that it only appeared once. I revoked certificates and closed X-Code many times, but it turned out that there was a 'hidden' certificate. I had an older Distribution Certificate that was not in the login keychain. It was in an unnamed keychain. When I deleted that one, it worked! So its worth looking around keychain access thoroughly!

我有同样的问题。我检查了我能在 SO 上找到的所有相关问题并按照步骤操作 - 但没有运气。它一直告诉我我的发行证书出现了不止一次,但我可以看到它只出现了一次。我多次吊销证书并关闭X-Code,但结果发现有一个“隐藏”的证书。我有一个旧的分发证书,它不在登录钥匙串中。它在一个未命名的钥匙链中。当我删除那个时,它起作用了!因此,值得彻底查看钥匙串访问!

回答by Viggnesh

Solution:

解决方案:

In keychain: I've found that if you switch to the “All Items” view, on the left hand side, the deletion seems to work every time. But maybe that was just blind luck. Even if it fails, the act of switching back and forth between “All Items” and “My Certificates” seems to force KA to refresh the view, and tells you if the delete has “worked” yet:

在钥匙串中:我发现如果您切换到左侧的“所有项目”视图,删除似乎每次都有效。但也许那只是盲目的运气。即使它失败了,在“所有项目”和“我的证书”之间来回切换的行为似乎会强制 KA 刷新视图,并告诉您删除是否“有效”:

link:

关联:

http://viggnesh.com/blog/problem-faced/

http://viggnesh.com/blog/problem-faced/

回答by Inder Kumar Rathore

Try to remove certificates from the xcode organizer.

尝试从 xcode 管理器中删除证书。