如何修复 "Command /usr/bin/codesign failed with exit code 1" 错误

How to fix "Command /usr/bin/codesign failed with exit code 1" error

我正在尝试对我的第一个应用程序进行代码签名,但我无法编译它,它一直给我 Command /usr/bin/codesign failed with exit code 1 错误

为了对应用程序进行代码签名,我遵循了 link 中的教程:

https://ioscodesigning.com/generating-code-signing-files/

我已经检查了我的钥匙串是否有重复的证书,清除了我的派生数据,并在构建设置中选择了我的配置文件。我不太了解 Info.plist 和捆绑包,所以其中一个可能有问题,但我不确定。

我还尝试了下面关于应用签名身份的第一个答案。添加配置文件后,错误从

开始
CodeSign /Users/myname/Library/Developer/Xcode/DerivedData/See_and_Say-eyscdjurjndlatcstdhogblpvxxb/Build/Products/Debug-iphonesimulator/See\ and\ Say.app
    cd "/Users/myname/Desktop/See and Say"
    export CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"

Signing Identity:     "-"

    /usr/bin/codesign --force --sign - --entitlements /Users/myname/Library/Developer/Xcode/DerivedData/See_and_Say-eyscdjurjndlatcstdhogblpvxxb/Build/Intermediates.noindex/See\ and\ Say.build/Debug-iphonesimulator/See\ and\ Say.build/See\ and\ Say.app.xcent --timestamp=none /Users/myname/Library/Developer/Xcode/DerivedData/See_and_Say-eyscdjurjndlatcstdhogblpvxxb/Build/Products/Debug-iphonesimulator/See\ and\ Say.app

/Users/myname/Library/Developer/Xcode/DerivedData/See_and_Say-eyscdjurjndlatcstdhogblpvxxb/Build/Products/Debug-iphonesimulator/See and Say.app: Is a directory
Command /usr/bin/codesign failed with exit code 1

CodeSign /Users/myname/Library/Developer/Xcode/DerivedData/See_and_Say-eyscdjurjndlatcstdhogblpvxxb/Build/Products/Debug-iphoneos/See\ and\ Say.app
    cd "/Users/myname/Desktop/See and Say"
    export CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"

Signing Identity:     "iPhone Developer: Certificate Name (5DTU5WC6AS)"
Provisioning Profile: "Provisioning Profile Name"
                  (bc4a4413-f6da-4433-9525-59daf158ed15)

    /usr/bin/codesign --force --sign 1CC2A9F98E64BE37CA2AAFB31DD68558C185C72A --entitlements /Users/myname/Library/Developer/Xcode/DerivedData/See_and_Say-eyscdjurjndlatcstdhogblpvxxb/Build/Intermediates.noindex/See\ and\ Say.build/Debug-iphoneos/See\ and\ Say.build/See\ and\ Say.app.xcent --timestamp=none /Users/myname/Library/Developer/Xcode/DerivedData/See_and_Say-eyscdjurjndlatcstdhogblpvxxb/Build/Products/Debug-iphoneos/See\ and\ Say.app

/Users/myname/Library/Developer/Xcode/DerivedData/See_and_Say-eyscdjurjndlatcstdhogblpvxxb/Build/Products/Debug-iphoneos/See and Say.app: Is a directory
Command /usr/bin/codesign failed with exit code 1

知道问题出在哪里吗?

您的问题可能是由于您 selected

的错误签名身份引起的

Signing Identity: "-"

似乎是无效的签名身份

尝试在项目的签名设置中select一个有效的签名身份:

目标构建设置 -> 签名