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

发布于 2024-08-17 01:04:53 字数 278 浏览 10 评论 0原文

我有以下错误:

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

这是我已经尝试解决此问题所做的操作:

  • 将包标识符设置为 com.server.pgmname
  • 将代码签名设置为“任何 Iphone OS 设备”
  • 设置代码签名身份我的发行版身份。

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

您有什么建议吗?

I have the following error:

Command /usr/bin/codesign failed with exit code 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.

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

Do you have any suggestions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(30

百变从容 2024-08-24 01:04:53

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

因此,在钥匙串访问中,单击Apple 全球开发者关系证书颁发机构证书,然后选择获取信息。然后,展开信任设置,并在“使用此证书时:”的组合框中选择“系统默认值”


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

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.

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".


Sigh: for those insistent on downvoting this answer, I am not claiming this to be the only solution for this problem. It's one solution. It may not work for you. There are multiple reasons for this codesign failure.

过期情话 2024-08-24 01:04:53

我遇到了完全相同的问题,这对我来说很有效:

Xcode >首选项>账户>查看详情>>只需刷新配置文件

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

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

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

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

终难遇 2024-08-24 01:04:53

觉得有必要分享这一点,尽管这很荒谬。

我在 Mac 上设置了第二个开发者帐户,但无法进行任何代码设计。错误是“用户取消了操作”。

简单的重新启动就为我解决了这个问题。

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".

A simple reboot fixed this for me.

情场扛把子 2024-08-24 01:04:53

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

在此处输入图像描述

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.

enter image description here

橘味果▽酱 2024-08-24 01:04:53

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

“在此处输入图像描述"

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

enter image description here

沒落の蓅哖 2024-08-24 01:04:53

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

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

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 group in your project (called "Resources" in my case), and then right click > add files to that and then choose the individual files. Project built immediately.

半世蒼涼 2024-08-24 01:04:53

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

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.

沫离伤花 2024-08-24 01:04:53

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

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.

不乱于心 2024-08-24 01:04:53

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

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

  2. 除了开发人员证书之外,还可以在配置门户的证书下安装 WWDR 中间证书,并确保您在“登录”>“登录”中看到它。钥匙串访问上的“证书”选项卡。

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.

木有鱼丸 2024-08-24 01:04:53

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

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

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

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

别低头,皇冠会掉 2024-08-24 01:04:53

我也遇到了同样的问题,并且很长时间都无法解决。我尝试了此页面和其他页面上的所有内容,但仍然不起作用。但最终,我确实找到了解决办法。

为此,请确保 Xcode 未运行。关闭 Xcode 后,打开终端并输入命令:

xattr -rc /[The File Directory of your project found in the File Inspector of your .xcodeproj file in Xcode]/

显然不要将文本放在括号中,只需将其替换为它所说的内容即可。按回车键。如果命令下方没有显示任何内容,请不要担心,它不适合我。之后,您可以关闭终端并打开 Xcode。现在一切都应该没问题了。
注意:运行您的项目可能需要更长的时间,但请耐心等待。

另请注意:不要否决此答案,因为它不起作用。这是一种对我有用的修复方法,但它可能对你不起作用,因为你可能还有其他东西坏了。

I had this same problem and couldn't figure it out for a long time. I tried everything on this page and others and it still didn't work. But eventually, I did find a fix.

For this to work, make sure Xcode is not running. After you've closed Xcode, open Terminal and type in the command:

xattr -rc /[The File Directory of your project found in the File Inspector of your .xcodeproj file in Xcode]/

Obviously don't put the text in brackets, just replace it with what it says. Hit enter. Don't worry if nothing shows up below the command, it didn't for me. After that, you can close out of Terminal and open Xcode. Now everything should be fine.
Note: It might take a little longer to run your project, but just wait it out.

Also note: Don't downvote this answer because it doesn't work. This is one way to fix it that worked for me, but it might not work for you because you might have something else that is broken.

最初的梦 2024-08-24 01:04:53

我第一次尝试按照配置助手创建配置文件时遇到此错误,结果发现他们没有提及 WWDR 中间证书。我安装了它并且对我来说效果很好。

I got this error the very first time I tried to make a provisioning profile by following the Provisioning Assistant and it turns out they fail to mention the WWDR Intermediate Certificate. I installed it and it worked fine for me.

罪#恶を代价 2024-08-24 01:04:53

这是我的解决方法:

  • 打开钥匙串访问,选择您的iOS证书,删除私钥
  • 然后返回xCode,您将看到警告消息和“撤销”按钮,单击它并解决错误。

Here is my way to resolve:

  • Open keychain access, select your iOS certificate, Delete private key
  • Then go back to xCode, you will see warning warning message and "Revoke" button, click it and error resolved.
↘人皮目录ツ 2024-08-24 01:04:53

大多数答案都会告诉您您有重复的证书。这对于我的情况来说是正确的,但答案忽略了如何做到这一点。

对我来说,我的帐户已过期,我必须获取新证书并安装它。接下来,我查看了钥匙串并删除了过期的证书,但仍然收到错误。对我有用的实际上是在钥匙串中搜索“iPhone”并删除所有过期的证书。显然,其中一些未显示在系统/证书或登录/证书中。

希望这有帮助!

Most answers will tell you that you have a duplicate certificate. This is true for my case but the answers left out how to do it.

For me, my account expired and I have to get a new certificate and install it. Next, I looked at Keychain and removes the expired certificate but still got the error. What works for me is actually searching for "iPhone" in Keychain and removing all expired certificates. Apparently, some of it are not shown in System/Certificates or login/Certificates.

Hope this helps!

愛上了 2024-08-24 01:04:53

就我而言,我的钥匙串中有一个额外的过期分发证书 - 我从 KeyChain Access 中删除了该证书,编译再次开始工作。

In my case, I had an extra expired distribution certificate in my keychain - I deleted the certificate from KeyChain Access and the compilation started working again.

十二 2024-08-24 01:04:53

如果您使用的是phonegap/cordova:

我在从 Cordova 构建时得到了这个,但对我来说解决方案要简单得多。权限问题。

只需将文件设置为正确的权限

chmod -R 774 ./projectfolder

然后设置所有权

chown -R youraccname:staff ./projectfolder 

If you're using phonegap/cordova:

I got this when building from Cordova but the solution for me was much simpler. A permissions issue.

Just set the files to correct permissions

chmod -R 774 ./projectfolder

And then set ownership

chown -R youraccname:staff ./projectfolder 
染年凉城似染瑾 2024-08-24 01:04:53

上面的一些答案暗示了这个问题,但没有明确说明纠正它的步骤。

这是我在变得超级令人沮丧之后的尝试,到目前为止似乎对我有用:

问题是由于您的 Apple 开发者门户 或可能在您的计算机中。到目前为止,我这样做并没有产生任何负面后果,而且效果很好。

  1. 关闭 Xcode!

  2. 您必须从您的开发者帐户中删除现有证书
    访问:https://developer.apple.com/account/ios/certificate/development /
    并选择开发帐户(应该有多个证书)
    我通过点击并选择撤销来撤销每一个证书。

选择开发certs

从 Mac Open Keychain 应用程序上的钥匙串中删除证书

  • 2.通过按 clover+space 并输入 keychaing

    并按 Enter
  • 在右上角搜索“开发人员”
  • 选择潜在的重复键并导出/删除它们,以便它们不在列表中。

搜索依据开发人员

  1. 最后在 XCode 中重新生成您的证书并重新启动

    • 重新打开 xcode
    • 通过转到项目 -> 重新生成新证书
      一般-->签名
    • 重新选择您的“团队帐户”

signing setup

  • 应该生成一个新的证书
  • 重新启动以达到良好的效果 - 并享受摆脱这个错误的乐趣(苹果应该真正解决这个问题,如果它可以轻松复制的话)

Some of the answers above allude to the problem but don't clearly spell out the steps to correct it.

Here is my attempt at after it has become super frustrating which seems to have worked for me so far :

The problem is caused because there is duplicate certificates in your Apple Developer portal or potentially in your machine. I haven't had any negative consequences from doing this and its worked so far.

  1. Close Xcode!

  2. You have to remove the existing certs from your developer account
    visit : https://developer.apple.com/account/ios/certificate/development/
    and select development account ( there should be multiple certs)
    I revoked each one by clicking on them and selecting revoke.

select development certs

2.remove certs from your keychain on your Mac

  • Open Keychain app by pressing clover+space and typing in keychaing
    and pressing enter
  • Search in the top right hand corner for "developer"
  • Select the potential duplicate keys and export/delete them so they aren't in the list.

search by developer

  1. Lastly regenerate your certs in XCode and rebooot

    • Reopen xcode
    • regenerate a new cert by going to project ->
      General --> Signing
    • reselect your "Team Account"

signing setup

  • a new cert should be generated
  • Reboot for good measure - and enjoy being free from this bug ( which Apple should really sort out, if it was at all possible to replicate easily)
春花秋月 2024-08-24 01:04:53

我最近也遇到了同样的问题。
钥匙串访问是罪魁祸首。

步骤:
去->公用事业 ->钥匙串访问
钥匙串访问:
编辑->更改钥匙串“登录”的密码

更改密码。
关闭并重新打开 Xcode、Clean &再次构建。

如果选项 - 更改钥匙串“登录”的密码 - 呈灰色:

  1. 确保在“钥匙串”下选择 ->登录并且挂锁图标打开。
    要打开挂锁,您需要钥匙串密码。如果您不知道密码,请转到步骤 2。

  2. 挂锁已解锁,但选项仍呈灰色。
    作为最后的手段:
    钥匙串访问 ->偏好设置
    偏好:
    “重置我的默认钥匙串”
    重置登录。但是请小心,因为存储的钥匙串将被删除,并且您也可能在其他连接的设备上重新登录。

I recently had the same issue.
Keychain Access was the culprit.

Steps:
Go -> Utilities -> Keychain Access
Keychain Access:
Edit -> Change Password for Keychain "login"

Change the password.
Close and reopen Xcode, Clean & build again.

If option - Change Password for Keychain "login" - is greyed out:

  1. Make sure under Keychains selected -> login and the padlock icon is open.
    To open the padlock you need the keychain password. If you do not know the password, go to Step 2.

  2. With padlock unlocked and still option is greyed out.
    As last resort:
    Keychain Access -> Preferences
    Preferences:
    "Reset My Default Keychains"
    Reset the login. However be careful as stored keychains will be removed and you may have re-login on other connected devices as well.

哑剧 2024-08-24 01:04:53

对我来说,我只需删除 xcode 中的“派生数据”

Open Xcode (12.3) -> Xcode->首选项->地点 ->单击 DerivedData 位置箭头 ->删除“DerivedData”文件夹->清洁和构建

For me, I just had to delete "Derived Data" in xcode

Open Xcode (12.3) -> Xcode -> Preferences -> Locations -> Click DerivedData location arrow -> Delete "DerivedData" folder -> Clean and build

江湖正好 2024-08-24 01:04:53

尝试在显示错误的“构建结果”视图中查找此错误的详细信息。在包含错误消息的行的右侧有一个包含多行的图标。这将向您展示一些有用的详细信息。

通过这种方式,我发现我的钥匙串中有一个重复的 iPhone 开发者证书 - 其中一个已经过期。也许在您的钥匙串中搜索“iphone”(首先选择“所有项目”类别)。

Try finding out the details of this error in the "Build Results" view where the error is shown. On the right side of the line with the error message there is an icon with several lines. This will show you some helpful details.

This way I found out for me it was a duplicate iPhone developer certificate in my keychain - one of which had been expired. Maybe search for "iphone" in your keychain (select "All Items" category first).

夏至、离别 2024-08-24 01:04:53

一个解决方案更适合我,如果您安装了两个版本的 XCode,并且安装了第二个版本而没有在同一目录(/Developer/)中卸载第一个版本,那么您就错了。
所以对我有用的解决方案是:

1 - 使用命令 sudo /Developer/Library/uninstall-devtools --mode=all 卸载当前的 Xcode 版本。

2 - 安装您首先拥有的第一个 Xcode 版本。

3 - 再次 sudo /Developer/Library/uninstall-devtools --mode=all。

4 - 然后,一切都干净了,您可以安装您想要的版本。

更多的事情:也许你需要在安装 Xcode 后重新启动计算机,甚至(在某些情况下)安装两次 Xcode。

我希望我能工作,我花了很多时间才知道这一点,祝你好运!

One solution more works with me, If you installed two versions of XCode and you install the second without uninstalling the first in the same directory (/Developer/), you did it wrong.
So the solution that works for me was:

1 - Uninstall the current Xcode version with the command sudo /Developer/Library/uninstall-devtools --mode=all.

2 - Install the first Xcode version you had first.

3 - Again sudo /Developer/Library/uninstall-devtools --mode=all.

4 - Then, all is clean and you are able to install the version you want.

More things: maybe you need to restart the computer after install the Xcode or even (in some cases) install two times the Xcode.

I hope I works it take me a lot of time to know that, good luck!!!

肥爪爪 2024-08-24 01:04:53

对我有用的解决方案与(我认为是)升级到 Xcode 4.2 后路径行为的更改有关:

您不能再手动输入“armv6 armv7”,而必须输入 $(VALID_ARCHS) :对于架构和项目的“构建设置”窗格中“架构”部分下的有效架构字段。 Xcode 会自动将该语句替换为“armv6 armv7”。

该字符串看起来与您手动输入的完全相同,但仍然指向将与您的构建一起生成的实际正确路径,...或者至少这是我的看法:P

不相关,我们使用在“其他签名标志”下也有“armv6 armv7”,现在将其取出,效果很好。这一定只是一个额外的。

谢谢,黑客快乐。

The solution that worked for me is related to (what I think is) a change of path behavior after upgrading to Xcode 4.2:

You can no longer manually enter "armv6 armv7" but must enter $(VALID_ARCHS) instead: both for the Architectures and Valid Architectures fields under the Architectures section in your project's Build Settings pane. Xcode will automatically replace the statement with 'armv6 armv7'.

This string looks exactly the same as if you would have typed it in manually but nevertheless point to the actual correct paths that will be generated along with your build, ...or at least this is my take on it :P

Unrelated, we used to have "armv6 armv7" as well under Other Signing Flags and now took that out and it works fine. This must be just an extra.

Thanks and happy hacking.
Gon

半衬遮猫 2024-08-24 01:04:53

我转到“密钥访问”,选择私钥,并将 XCode 添加到可以访问它的应用程序列表中。这对我有用

I went to Key Access, selected the private key, and added XCode to the list of apps that can access it. That worked for me

嘿嘿嘿 2024-08-24 01:04:53

如果有人使用 Xcode 版本。 3.xx 并从 Mac OS 10.7 升级到 10.8,dev。除了新的 codesign 二进制文件之外,其他工具都可以正常工作。要解决此问题,只需将旧的 codesign 和 codesign_allocate 二进制文件(我希望您有备份)复制到 /usr/bin/ 文件夹,然后重命名或备份新文件。

If anyone uses Xcode ver. 3.x.x and upgrades from Mac OS 10.7 to 10.8, dev. tools will work just fine except the new codesign binary .. To fix that just copy the old codesign and codesign_allocate binaries (I hope you have backup) to /usr/bin/ folder and rename or backup the new one.

笑看君怀她人 2024-08-24 01:04:53

我的项目名称中有特殊字符,将其重命名以删除字符、问号,并确保启用开发人员证书解决了该问题。

I had special characters in the project name,renaming it to remove the characters, question marks, and insuring a developer certificate was enabled fixed the issue.

谈场末日恋爱 2024-08-24 01:04:53

当我遇到此错误时,这是​​由于处于钥匙串访问状态,并在询问我是否要让程序访问已保存的密码。返回并选择“允许”并输入我的系统密码修复了 XCode 中的问题。

When I experienced this error, it was due to having been in Keychain Access, and choosing 'Disallow' when asked whether I wanted to let the program access a saved password. Going back in and selecting 'Allow' and typing my system password fixed the problem in XCode.

岁月打碎记忆 2024-08-24 01:04:53

对我来说问题是 HTTP 代理

For me the problem was HTTP proxy

半山落雨半山空 2024-08-24 01:04:53

这是我解决同样问题的方法。它可能对某人有帮助。

我从服务器中删除了开发配置文件(我正在使用),然后创建了一个名称略有不同的配置文件。
我用过它并且有效。

Here is how I solved the same problem. It may help someone.

I deleted the Development Provisionning Profile (that I was using) from the server, then created one with a slightly different name.
I used it and it worked.

み青杉依旧 2024-08-24 01:04:53

当我在一个项目中有多个目标,并且我将 CFBundleExecutable plist 属性更改为目标名称以外的其他内容时,就会发生此问题。

例如,我在一个项目中有以下目标:

  • SomeApp
  • SomeApp WatchKit Extension
  • SomeApp WatchKit App
  • SomeApp Today Widget
  • SomeApp for OS X(这是发生协同设计错误的目标)

SomeApp for OS X将其 CFBundleExecutable 属性设置为 SomeApp,这不仅与名为 SomeApp 的第一个目标冲突,而且与它的目标目标不同。将 SomeApp for OS X 更改为 SomeApp,然后重命名第一个目标对我来说效果很好。

This issue happened for me when I had multiple targets in one project, and I changed the CFBundleExecutable plist property to something other than the target's name.

So, for example, I had the following targets in one project:

  • SomeApp
  • SomeApp WatchKit Extension
  • SomeApp WatchKit App
  • SomeApp Today Widget
  • SomeApp for OS X (this is the target where the codesign error happens)

SomeApp for OS X had its CFBundleExecutable property set to just SomeApp, which not only conflicted with the first target called SomeApp but was different from the target it was meant for. Changing SomeApp for OS X to SomeApp and then renaming the first target worked fine for me.

怪我鬧 2024-08-24 01:04:53

对我来说,我在框架方案上启用了代码覆盖率,而不是在其相应的测试方案上。禁用代码覆盖率可以解决问题。

For me I had code coverage enabled on the scheme of a framework rather than it's corresponding test scheme. Disabling the code coverage sorted the problem.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文