I use to automate the build of my Adhoc and Distrib release of my apps with a simple script:
echo "***** xcodebuild: compile project" xcodebuild -target "${PROJECT_NAME}" -sdk "${TARGET_SDK}" -configuration Release CONFIGURATION_BUILD_DIR="${PROJECT_BUILDDIR}" echo "***** xcrun Package app (ipa file) - Adhoc release" /usr/bin/xcrun -sdk iphoneos PackageApplication "${PROJECT_BUILDDIR}/${PROJECT_NAME}.app" -o
"${PROJECT_BUILDDIR}/${PROJECT_NAME}_adhoc.ipa" --sign "${DEVELOPPER_NAME}" --embed "${ADHOC_PROVISONNING_PROFILE}" echo "* xcrun Package app (ipa file) - AppStore release" /usr/bin/xcrun -sdk iphoneos PackageApplication "${PROJECT_BUILDDIR}/${PROJECT_NAME}.app" -o "${PROJECT_BUILDDIR}/${PROJECT_NAME}_appstore.ipa" --sign "${DEVELOPPER_NAME}" --embed "${APPSTORE_PROVISONNING_PROFILE}"
It was working fine before. But then I installed Mac OS Maverik and I also updated my expired certificates & prov profiles. And since then, when I try to upload the generated IPA to iTunes Connect (for the Distribution release) or TestFlight (for the Adhoc release), I get this error message:
ERROR ITMS-9000: "Invalid Code Signing. The executable 'Payload/mosa_en_it.app/mosa_en_it' must be signed with the certificate that is contained in the provisioning profile." at SoftwareAssets/SoftwareAsset (MZItmspSoftwareAssetPackage)
But it's working when I do it manually on XCode (Archive->Distribute..).
Also, I don't know if it's related but I have lots of duplicates certificates: screenshot (but I don't know how to delete them)
Thanks in advance for your help