Here are some solutions I found here
Check the CODE_SIGN_IDENTITY property in your build settings. Is your
provisioning profile selected there? You also need to enter a valid
bundle identifier in your apps .plist. The identifier has to match
the one you provided when generating the profile. Apple has some
notes on that here.
Apple also has a collection of code signing problems with solutions in
a document: Technical Note TN2407 Code Signing Troubleshooting
Index
Another solution could be something to do with keychain access. This may solve your 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".
It could also be that Xcode is confused between 2 accounts. Make sure you are using only one.
If none of these work, please get back to me.
Source: /usr/bin/codesign failed with exit code 1