I'm trying to migrate some iOS xcode build servers to use Mavericks which is essential for xcode 6 builds. However, invoking xcodebuild with code that used to work in mountain lion just doesn't seem to work anymore and results in:
Code Sign error: No codesigning identities found: No codesigning identities
(i.e. certificate and private key pairs) that match the provisioning profile
specified in your build settings (“provision name”) were found.
Our build command is pretty standard and the certificate is in place, doing this exact same code on mountain lion "just works" (notice I added line breaks for readability and replaced some private data such as project name and provisioning):
/Applications/Xcode5.app/Contents/Developer/usr/bin/xcodebuild -project ProjectName.xcodeproj/
-alltargets -configuration Release -sdk iphoneos7.0 build
PROVISIONING_PROFILE=XXXX-XXXXX-XXXX-XXXX-XXXXXXX CODE_SIGN_IDENTITY="iPhone Distribution: name of company (XXXXXXXX)"
KEYCHAIN=/Users/administrator/Library/Keychains/temp.keychain OTHER_CODE_SIGN_FLAGS=--keychain /Users/administrator/Library/Keychains/temp.keychain
I have a workaround that signs with a "known working" certificate/provisioning and replaces them using the codesign tool after the build completes but that is causing some side effects to the users that I have no idea how to workaround. As far as I can tell the above should work and might just be missing a new argument to xcodebuild that I am unaware of.
Mavericks ignores the keychain set default when invoking:
security default-keychain
And the initial xcodebuild checking logic ignores the command line keychain arguments!
The following command:
security list-keychains
Won't return the keychain you set. The workaround is actually simple:
security list-keychains -s /path/to/your/keychain
And then the right certificate will be found by the initial checking process.