KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: What to do when code signing fails?
PRODUCT: 4D | VERSION: 16 | PLATFORM: Mac OS X
Published On: September 28, 2017

When building a signed application on macOS with 4D, there are various reasons why you may encounter a code signature failed error like this


Checking the Log (4dbase/Logs/BuildApp.log.xml) may show something like this:

<Log>
  <MessageType>Error</MessageType>
  <Target>Application</Target>
  <CodeDesc>SIGNING_FAILED</CodeDesc>
  <CodeId>38</CodeId>
  <Message>Code signature failed</Message>
</Log>


This error is not very helpful.

To obtain a better understanding of the underlying error it is advised to manually sign the application yourself from Terminal. Manually signing the application outside of 4D can be useful for troubleshooting the issue because the underlying error will be readily available in the Terminal window.

To manually sign the application, first you must build the application again without signing, then after building the application you can try to sign it manually from Terminal.

The syntax used by 4D for codesigning is:
codesign -s "${nameCertificat}" -fvvvv "${PathSign}"


If the application is stored @ "/path/to/myBuiltApp.app/" and the developer certificate to use for signing is named "Developer ID Application: xyz (123)" then the command syntax would be:
codesign -s "Developer ID Application: xyz (123)" -fvvvv /path/to/myBuiltApp.app/


Doing this should help reveal the underlying error that was encountered.

Some potential errors that could be found are:
  • ./myBuiltApp.app: resource fork, Finder information, or similar detritus not allowed
  • ./myBuiltApp.app: timestamps differ by 198 seconds - check your system clock
  • Developer ID Application: xyz (123): ambiguous (matches "Developer ID Application: xyz (123)" and "Developer ID Installer: xyz (123)" in /Users/username/Library/Keychains/login.keychain-db)
  • Agreeing to the Xcode/iOS license requires admin privileges, please run “sudo xcodebuild -license” and then retry this command.

Each of the errors above wuld require a different solution. Once the error recieved outside of 4D has been addressed it should be safe to attempt to build/sign from within 4D again.