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

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

/usr/bin/codesign failed with exit code 1

iphoneiosxcodedeploymentcode-signing

提问by PF1

I am attempting to deploy my first development iPhone app, and am running into some problems. I have successfully went though the online Provisioning Assistant, but now I am stuck. No matter what I do, I always get the following error.

我正在尝试部署我的第一个开发 iPhone 应用程序,但遇到了一些问题。我已经成功地通过在线 Provisioning Assistant,但现在我被卡住了。无论我做什么,我总是收到以下错误。

/usr/bin/codesign failed with exit code 1

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

Anyone have any ideas why this is happening?

任何人都知道为什么会发生这种情况?

采纳答案by Thomas Zoechling

Update:
The Technical Note in my original answer is now deprecated. Apple posted a collection of code signing problems (and some solutions) in a new document: Technical Note TN2407 Code Signing Troubleshooting Index

更新:
我原始答案中的技术说明现已弃用。Apple 在新文档中发布了一系列代码签名问题(以及一些解决方案):技术说明 TN2407 代码签名故障排除索引

Check the CODE_SIGN_IDENTITY property in your build settings. Is your provisioning profile selected there?
You also need to enter a valid bundle identifier in your apps .plist.
The identifier has to match the one you provided when generating the profile.
Apple has a technote about that here.

检查构建设置中的 CODE_SIGN_IDENTITY 属性。是否在那里选择了您的配置文件?
您还需要在您的应用程序 .plist 中输入一个有效的包标识符。
标识符必须与您在生成配置文件时提供的标识符相匹配。
苹果有一个关于这里的技术说明。

回答by Tobias Cohen

I just came across this error, and here's what I found out in case this helps anyone: I discovered that you can right click the error message in Xcode and choose expand to get more details, including a description of the problem.

我刚刚遇到了这个错误,这是我发现的,以防这对任何人有帮助:我发现您可以在 Xcode 中右键单击错误消息并选择展开以获取更多详细信息,包括问题的描述。

In my case, I had two copies of my developer certificate with the same name in different keychain files, and Xcode couldn't figure out which one to use.

就我而言,我在不同的钥匙串文件中有两份同名的开发人员证书副本,而 Xcode 无法确定要使用哪一个。

回答by CODE

It might be strange answer for codesign issue in Xcode 9.0. I was receiving this error too and did not know what to be done, because everything was correct.

对于 Xcode 9.0 中的协同设计问题,这可能是一个奇怪的答案。我也收到了这个错误,不知道该怎么做,因为一切都是正确的。

I went to the keychain, I had the login option "unlocked". I locked it and compiled my build again. Xcode itself asked me to open access keychain. I gave access and it worked.

我去了钥匙串,我有“解锁”的登录选项。我锁定它并再次编译我的构建。Xcode 本身要求我打开访问钥匙串。我给了访问权限并且它起作用了。

Steps were:

步骤是:

  1. Go to keychain
  2. Lock it
  3. Archive the code, build the project again
  1. 转到钥匙串
  2. 锁定它
  3. 归档代码,重新构建项目

回答by Nate

I had the exact same error, and tried everything under the sun, including what was elsewhere on this page, with no success. 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 Authority certificate, select Get Info. Then, expand the Trust settings, and for the combo box for "When using this certificate:", choose "System Defaults".

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

Others have commented that you may have to do this in Systemand loginkeychains for these errors.

其他人评论说,对于这些错误,您可能必须在系统登录钥匙串中执行此操作。

回答by Rahul Kumar

There could be a lot of reason when you get this kind of error:

出现此类错误可能有很多原因:

  1. Check whether you have selected a provisioning profile which includes the valid Code Signing Identityand a valid Bundle Identifierin Settings. (Goto Build Settings->Signing->Provisioning Profile).

  2. Open Keychain Accessand click on lock icon at top left, so it will lock the login keychain and then again click to unlock.

  1. 检查您是否在设置中选择了包含有效代码签名身份和有效捆绑标识符的配置文件。(转到构建设置-> 签名-> 配置文件)。

  2. 打开钥匙串访问并单击左上角的锁定图标,因此它将锁定登录钥匙串,然后再次单击以解锁。

enter image description here

在此处输入图片说明

  1. Goto File->Project Settings->Derived Data and delete your project build folder. After that clean and build your app.
  1. 转到 File->Project Settings->Derived Data 并删除您的项目构建文件夹。之后清理并构建您的应用程序。

回答by Wayne Lo

I had the same problem the distribution build. It just happened all of sudden. In fact I did not have this problem a few days ago and I had my Ad-Hoc version compile right. This issue came up because my certificate just expired today. So I went create a new provisional following Apple's guidance: (http://developer.apple.com/ios/manage/distribution/index.action).

我在发行版中遇到了同样的问题。它只是突然发生。事实上,几天前我没有遇到这个问题,我的 Ad-Hoc 版本编译正确。出现这个问题是因为我的证书今天刚刚过期。所以我按照 Apple 的指导创建了一个新的临时文件:(http://developer.apple.com/ios/manage/distribution/index.action)。

After spending hours on the net and made sure I had not fallen for what could go wrong. Here is what save me as suggested by Tobias and Dan Ray:

在网上花了几个小时并确保我没有因为可能出现的问题而堕落之后。以下是 Tobias 和 Dan Ray 建议的拯救我的方法:

  1. "...discovered that you can right click the error message in Xcode to view details".
  2. "...the issue was an expired certificate on my System keychain. Keychain Access doesn't, by default, show expired certs".
  1. “...发现您可以在 Xcode 中右键单击错误消息以查看详细信息”。
  2. “...问题是我的系统钥匙串上的证书过期。默认情况下,钥匙串访问不显示过期的证书”。

The detailed information told me about ambiguous matching two certificates. One of them happened to be an expired certificate in the System key chain. So I deleted the expired one then it worked! I also had a concern about what to enter in the "common name" when create the distribution certificate using the keychain utility: my name or my company name. In my case, I entered my name. I am guessing it is the same as the title that addressed by the developer's auto responder email.

详细信息告诉我关于两个证书的模糊匹配。其中一个恰好是系统密钥链中的过期证书。所以我删除了过期的一个然后它就起作用了!在使用钥匙串实用程序创建分发证书时,我还担心在“通用名称”中输入什么:我的名字或我的公司名称。就我而言,我输入了我的名字。我猜它与开发人员的自动回复电子邮件地址的标题相同。

Great help. Thanks.

很大的帮助。谢谢。

回答by Matt Montag

What worked for me was adding --deepto Other Code Signing Flagsin Build Settings. More information here: Codesign of Dropbox API fails in Xcode 4.6.3: "code object is not signed at all"

什么工作对我来说是添加--deep其他代码签名旗在构建设置。此处的更多信息:Dropbox API 的代码设计在 Xcode 4.6.3 中失败:“代码对象根本没有签名”

Unfortunate that this ambiguous error condition has 400 different solutions, but I digress.

不幸的是,这种模棱两可的错误条件有 400 种不同的解决方案,但我离题了。

回答by Fiach Reid

If the error immediately preceding the codesign error says something like 'resource fork, Finder information, or similar detritus not allowed'

如果紧接在 codesign 错误之前的错误是“不允许资源分叉、Finder 信息或类似的碎屑”之类的内容

Then navigate to the .app file in Terminal and type:

然后导航到终端中的 .app 文件并键入:

xattr -cr < path_to_app_bundle >

xattr -cr < path_to_app_bundle >

ref: https://developer.apple.com/library/content/qa/qa1940/_index.html

参考:https: //developer.apple.com/library/content/qa/qa1940/_index.html

回答by Nanki

Sometimes your build folder simply needs cleaning - it certainly worked for me. Thanks to loafer-projectfor the solution.

有时您的构建文件夹只需要清理 - 它当然对我有用。感谢loafer-project的解决方案。

回答by MCP

I had the same problem but also listed in the error log was this: CSSMERR_TP_CERT_NOT_VALID_YET

我遇到了同样的问题,但错误日志中还列出了以下内容:CSSMERR_TP_CERT_NOT_VALID_YET

Looking at the certificate in KeyChain showed a similar message. The problem was due to my Mac's system clock being set incorrectly. As soon as I set the correct region/time, the certificate was marked as valid and I could build and run my app on the iPhone

查看 KeyChain 中的证书显示了类似的消息。问题是由于我的 Mac 系统时钟设置不正确。一旦我设置了正确的地区/时间,证书就会被标记为有效,我可以在 iPhone 上构建和运行我的应用程序