Error - Command CodeSign failed with a nonzero exit code

Issue 1) When I select Generic iOS Device and run Product > Archive I get an error Command CodeSign failed with a nonzero exit code

Issue 2) When I select a simulator e.g. iPhone 11 Pro Max , the option Archive under Product menu is not highlighted anymore.
I am having the same issue. I ran into the same error while building and found a solution via Google to use Terminal to navigate (cd) to the folder listed in the error in XCode and then run the following two commands..

xattr -lr .
xattr -cr .

This works for build/run but when archiving it still throw the error. I cannot archive. Did you end finding a solution?
If you look in the build transcript you should see some output from codesign explaining why it failed.

This output is often kinda vague so, if you’re unsure what it means, post it here and I’ll take a look. Use a code block (triple backticks) to make it easier to read.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
Error - Command CodeSign failed with a nonzero exit code
 
 
Q