2

I am trying to code sign my first app but I can't get it to compile and it keeps giving me the Command /usr/bin/codesign failed with exit code 1 error

To code sign the app I followed the tutorial at this link:

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

I've already checked my keychain for a duplicate certificate, cleared my Derived Data, and selected my provisioning profile in build settings. I don't quite understand Info.plists and bundles so it may be a problem with one of these, but I'm not sure.

I also tried the first answer below about the signing identity for the app. After I added my provisioning profiles, the error went from

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

to

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

Any ideas what the problem is?

2Code
  • 25
  • 1
  • 7

1 Answers1

0

Your issue is probably caused by the wrong signing identity you have selected

Signing Identity: "-"

Seems to be an invalid signing identity

Try to select a valid signing identity on your project's signing settings:

Target build settings -> Signing

Mourad Brahim
  • 531
  • 2
  • 15
  • Thank you for the help! I was able to select a signing identity, so the string in my error does not come up blank. I edited my question to show this. – 2Code Jan 02 '19 at 15:15
  • Please check if the signing certificate (and the related private key) and the provisionning profile are well installed. Please note that the signing certificate should be installed on your login keychain. If they are OK, try to lock and unlock your login keychain. I have solved similar issue by lock / unlock my login keychain. – Mourad Brahim Jan 02 '19 at 15:57
  • It appears that everything is installed correctly, and I just locked and unlocked the keychain and restarted Xcode. Is there any other information I can provide to help you find a solution? – 2Code Jan 03 '19 at 02:48
  • Please check this post: https://stackoverflow.com/questions/1090288/usr-bin-codesign-failed-with-exit-code-1 If it's already done, could you share some screenshots related to your code sign config? This may help to find a solution. – Mourad Brahim Jan 03 '19 at 08:39
  • I don't know exactly what happened, but I tried changing the file names in the build target to fix a multiple build commands error. I got a new error from that, so I changed it back, and the old error was gone. Likely couldn't have 'fixed' it without your signing identity advice, so thanks! – 2Code Jan 03 '19 at 19:07
  • Nevermind. I restarted xcode and the error came back. I really have no idea what's going on. – 2Code Jan 04 '19 at 15:56