Travis CI Fails to Build with a Code Signing Error
Did you try to add this on you travis.yml:
language: objective-cscript: - xcodebuild [DEFAULT_OPTIONS] CODE_SIGNING_REQUIRED=NO
Or import a development (and distribution if you are going to use on your build) cert/key to the keychain and copy your team provisioning profile, to make the code signing work. Like this:
language: objective-cbefore_script:- ./scripts/add-key.shscript: - xcodebuild [DEFAULT_OPTIONS] CODE_SIGNING_REQUIRED=NO
add-key.sh
#!/bin/shKEY_CHAIN=ios-build.keychainsecurity create-keychain -p travis $KEY_CHAIN# Make the keychain the default so identities are foundsecurity default-keychain -s $KEY_CHAIN# Unlock the keychainsecurity unlock-keychain -p travis $KEY_CHAIN# Set keychain locking timeout to 3600 secondssecurity set-keychain-settings -t 3600 -u $KEY_CHAIN# Add certificates to keychain and allow codesign to access themsecurity import ./scripts/certs/dist.cer -k $KEY_CHAIN -T /usr/bin/codesignsecurity import ./scripts/certs/dev.cer -k $KEY_CHAIN -T /usr/bin/codesignsecurity import ./scripts/certs/dist.p12 -k $KEY_CHAIN -P DISTRIBUTION_KEY_PASSWORD -T /usr/bin/codesignsecurity import ./scripts/certs/dev.p12 -k $KEY_CHAIN -P DEVELOPMENT_KEY_PASSWORD -T /usr/bin/codesignecho "list keychains: "security list-keychainsecho " ****** "echo "find indentities keychains: "security find-identity -p codesigning ~/Library/Keychains/ios-build.keychainecho " ****** "# Put the provisioning profile in placemkdir -p ~/Library/MobileDevice/Provisioning\ Profilescp "./scripts/profiles/iOSTeam_Provisioning_Profile_.mobileprovision" ~/Library/MobileDevice/Provisioning\ Profiles/cp "./scripts/profiles/DISTRIBUTION_PROFILE_NAME.mobileprovision" ~/Library/MobileDevice/Provisioning\ Profiles/
Please find my .travis.yml file below, which fixes this error message and others, when using an Xcode 7 project + Swift + iOS 9 + the continuous integration tool available on travis-ci.org:
# http://docs.travis-ci.com/user/languages/objective-c/# https://github.com/facebook/xctoollanguage: objective-cosx_image: xcode7# xcode_project: SampleNotifcations/SampleNotifcations.xcodeproj# xcode_workspace: SampleNotifcations/SampleNotifcations.xcworkspace# xcode_scheme: SampleNotifcationsTestspodfile: SampleNotifcations/Podfile# xcode_sdk: iphonesimulator9.0script: xctool -workspace SampleNotifcations/SampleNotifcations.xcworkspace -scheme SampleNotifcationsTests -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6 Plus' build test ONLY_ACTIVE_ARCH=NO CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NObefore_install: - brew update - brew uninstall xctool && brew install --HEAD xctool
Sources:
If you don't need to build for iphoneos
, e.g. if you just want to know if the project builds or your unit tests pass. You can specify the iphonesimulator
sdk. By doing this, xctool
will not sign the code.
script: xctool -sdk iphonesimulator -workspace {WORKSPACE}.xcworkspace -scheme {SCHEME} build test