ios 命令 /usr/bin/codedesign 失败,退出代码为 1

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2017756/
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-08-30 16:45:16  来源:igfitidea点击:

Command /usr/bin/codesign failed with exit code 1

iosiphoneexit-codecodesign

提问by Daniel

I have the following error:

我有以下错误:

Command /usr/bin/codesign failed with exit code 1

命令 /usr/bin/codedesign 失败,退出代码为 1

Here is what I already did for trying to fix this:

这是我为尝试解决此问题所做的工作:

  • set the bundle identifier to com.server.pgmname
  • set the code signing to "Any Iphone OS Device"
  • set the Code Signing Identity to my Distribution identity.
  • 将包标识符设置为 com.server.pgmname
  • 将代码签名设置为“Any Iphone OS Device”
  • 将代码签名标识设置为我的分发标识。

The error only occurs when I try to build on my device, on the simulator everything works fine.

该错误仅在我尝试在我的设备上构建时发生,在模拟器上一切正常。

Do you have any suggestions?

你有什么建议吗?

采纳答案by Daniel

I just created a new project, copied all my classes and resources and then it worked!

我刚刚创建了一个新项目,复制了我所有的类和资源,然后就成功了!

回答by Nate

I had the exact same error, and tried everything under the sun, including what was suggested elsewhere on this page. What the problem was for me was that in Keychain Access, the actual Apple WWDR certificate was marked as "Always Trust". It needed to be "System Defaults". That goes for your Development and Distribution certificates, too. If any of them are incorrectly set to "Always Trust", that can apparently cause this problem.

我遇到了完全相同的错误,并在阳光下尝试了一切,包括本页其他地方的建议。对我来说问题是在 Keychain Access 中,实际的 Apple WWDR 证书被标记为“始终信任”。它需要是“系统默认值”。这也适用于您的开发和分发证书。如果其中任何一个被错误地设置为“始终信任”,这显然会导致此问题。

So, in Keychain Access, click on the Apple Worldwide Developer Relations Certificate Authoritycertificate, select Get Info. Then, expand the Trustsettings, and for the combo box for "When using this certificate:", choose "System Defaults".

因此,在Keychain Access 中,单击Apple Worldwide Developer Relations Certificate Authority证书,选择Get Info。然后,展开信任设置,对于“使用此证书时:”的组合框,选择“系统默认值”



Sigh: for those insistent on downvoting this answer, I am not claiming this to be the only solution for this problem. It's onesolution. It may not work for you. There are multiplereasons for this codesignfailure.

叹息:对于那些坚持反对这个答案的人,我并不是说这是解决这个问题的唯一方法。这是一种解决方案。它可能不适合你。这种失败有多种原因codesign

回答by mgm

I had the exact same problem and this did the trick for me:

我遇到了完全相同的问题,这对我有用:

Xcode > Preferences > Accounts > View Details > And just refresh the Provisioning Profile

Xcode > Preferences > Accounts > View Details > 然后刷新 Provisioning Profile

Seems like the accounts in Xcode were not updated with the latest provisioning profiles so a quick refresh sorted this out.

似乎 Xcode 中的帐户没有使用最新的配置文件更新,因此快速刷新可以解决这个问题。

回答by Chris Newman

Feel the need to share this, even though it's ridiculous.

觉得有必要分享这个,即使它很荒谬。

I'd set up a second developer account on my Mac and couldn't codesign anything. The error was "the user cancelled the operation".

我在我的 Mac 上设置了第二个开发者帐户,但无法协同设计任何东西。错误是“用户取消了操作”。

A simple reboot fixed this for me.

一个简单的重启为我解决了这个问题。

回答by Teddy

I was fighting for about 2-3 hours to codesign a project with Parse API. It turned out that the embedded frameworks caused the problem. Make sure you set "Code sign on copy" (see picture). If does not work delete the Parse and Bolts frameworks from the list and remove them from your project then add them again.

我花了大约 2-3 个小时来使用 Parse API 对项目进行协同设计。事实证明,嵌入式框架导致了这个问题。确保您设置了“副本上的代码签名”(见图)。如果不起作用,请从列表中删除 Parse 和 Bolts 框架并将它们从您的项目中删除,然后再次添加它们。

enter image description here

在此处输入图片说明

回答by Psiloc

Just troubleshooted this same issue. I'd created a resources folder with my icons inside, then added it to my project via right-click > Add Files > [select resources folder]. Apparently this is a bad idea.

刚刚解决了同样的问题。我创建了一个包含我的图标的资源文件夹,然后通过右键单击> 添加文件> [选择资源文件夹] 将其添加到我的项目中。显然这是一个坏主意。

Instead create a new groupin your project (called "Resources" in my case), and then right click > add files to that and then choose the individual files. Project built immediately.

而是在您的项目中创建一个新(在我的例子中称为“资源”),然后右键单击 > 添加文件,然后选择单个文件。项目立马建成。

回答by Mat Zero

What worked for me was to realize that Xcode did not have access to the certificates. Please check that your certs are accessible by Xcode. Go to Keychain Access -> Certificates -> Open the Cert and double click on the private key -> Select Access Control

对我有用的是意识到 Xcode 无法访问证书。请检查您的证书是否可以通过 Xcode 访问。转到钥匙串访问 -> 证书 -> 打开证书并双击私钥 -> 选择访问控制

enter image description here

在此处输入图片说明

回答by Ace

For me, I just updated to Xcode 8, and converted my Swift 2.2 code to Swift 3 code, and I got errors in the Unit Testing and UI Testing. I just cleaned and then all the errors disappeared.

对我来说,我刚刚更新到 Xcode 8,并将我的 Swift 2.2 代码转换为 Swift 3 代码,但我在单元测试和 UI 测试中遇到了错误。我刚清理完,然后所有错误都消失了。

回答by Andy

Very often the error /usr/bin/codesign failed with exit code 1occurred in case the user has no file extensions for texture files in Models.scnassetsfolder. macOSvery often generates a files with hidden extensions.

/usr/bin/codesign failed with exit code 1如果用户在Models.scnassets文件夹中没有纹理文件的文件扩展名,通常会发生错误。macOS经常生成带有隐藏扩展名的文件。

For example: you have a file myTexturebut it must include an extension as well – myTexture.png.

例如:您有一个文件,myTexture但它也必须包含扩展名 – myTexture.png.

回答by umop

For anyone with this problem in the future (who doesn't want to rebuild their project), an additional question to ask is whether you have a space in your product name. I'd recommend going through your properties (right-click -> get info) of your project and your target. For my project, the only place that a space was needed was in the plist for the bundle display name.

对于将来遇到此问题的任何人(不想重建他们的项目),要问的另一个问题是您的产品名称中是否有空格。我建议您查看项目和目标的属性(右键单击 -> 获取信息)。对于我的项目,唯一需要空格的地方是包显示名称的 plist 中。

回答by a_s_

After hours of googling and trying out different things, this is what fixed it for me:

经过数小时的谷歌搜索和尝试不同的东西,这就是为我解决的问题:

  1. Make sure there are no certificates in the System > Certificates tab on Keychain Access. Remove all duplicate certificates from there.

  2. Install the WWDR intermediate certificate under certificates from the provisioning portal, in addition to the developers certificates and make sure you see it in the Login > Certificates tab on Keychain Access.

  1. 确保钥匙串访问的系统 > 证书选项卡中没有证书。从那里删除所有重复的证书。

  2. 除了开发人员证书外,在来自供应门户的证书下安装 WWDR 中间证书,并确保您在钥匙串访问的登录 > 证书选项卡中看到它。