Hi guys
I was having the exact same issue and was able to find a solution by creating a separate keychain for the certificate, then using the below shell command extract the SHA-1 hash of the certificate.
security find-identity -v -p codesigning <keychain_path> | awk -F' ' 'NR==1{print $2}'
You can then use xcodebuild to pass this certificate sha1 hash for the key CODE\_SIGN\_IDENTITY into the OTHER\_CODE\_SIGN\_FLAGS like below:
xcodebuild -workspace Project.xcworkspace -scheme <ProjectScheme> -configuration <ProjectConfigiguration>
OTHER_CODE_SIGN_FLAGS='--keychain=<Keychain_Path>' CODE_SIGN_IDENTITY=<SHA1_HASH_FOR_CERTIFICATE clean archive		
Hope this helps you overcome this issue.
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags: