I'm trying to archive an app from command line but it gives the following error:
Code Sign error: The identity 'iPhone Distribution: XXX' doesn't match any valid, non-expired certificate/private key pair in your keychains
And I'm using the following lines to build and archive the app:
export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer
xcodebuild -target TestAppLogicTests \
-sdk iphonesimulator \
-configuration Debug \
TEST_AFTER_BUILD=YES \
clean build | /usr/local/bin/ocunit2junit.rb
# tests passed archive app
export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer
/usr/bin/xcrun xcodebuild -scheme TestApp clean archive \
CODE_SIGN_IDENTITY="iPhone Distribution: XXX"
I'm sure that my CODE_SIGN_IDENTITY is correct (I've checked it in the .pbxproj file). I've already tried to redownload my distribution certificate but that didn't work either. It's working fine in xCode itself.
Anyone has an idea on what I could try?
Thanks!
Open keychain. Do you see your developer (or distribution) certificate)?
If yes, can you click on it to open a dropdown? Under it, do you see a text called private key with something else?
If you don't see any dropdown and private key, you must:
If this is confusing, there are plenty of questions that explains this in more details, like this one.