command/usr/bin/codesign failed with exit code 1- code sign error

I’ve now spent 3 hours searching for the error mentioned above:

command /usr/bin/codesign failed, exit code 1

Here’s what I’ve done to try and fix this:
Set the bundle identifier to com.server. code signing to “any Iphone OS device” set the code signing identity to my distribution identity. The error only happens when I try to set it on my device and everything works fine on the emulator. Do you have any suggestions? Thank you very much in advance! I have the exact same error and have tried everything, including the suggestions elsewhere on this page. My problem is that in Keychain Access, the actual Apple WWDR certificate is marked as “always trusted”. It needs to be “system default”. This also applies to your Development Certificates and Issuing Certificates. If either of them is incorrectly set to “Always Trusted”, this will obviously cause the problem. So, in Keychain Access, click Apple Worldwide Developer Relations Certificate Authority Certificate, select Get Info. then, expand the Trust setting, and for ” When using this certificate:” combo box, select “System defaults”.
Sigh:For those who insist on vetoing this answer, I’m not saying this is the only solution to the problem. It’s a solution. It may not work for you.

Read More: