Travis CI无法使用代码签名错误构建

Sev*_*its 21 macos xcode code-signing travis-ci

Travis CI无法构建我的应用程序,因为Xcode项目设置为需要代码签名而Travis没有我的证书.我可以通过禁用代码签名来解决此问题,但随后沙盒和授权将无法正常工作.我知道,从普通的命令行构建的时候,你可以传递CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NOxcodebuild禁用代码签名,但你怎么特拉维斯CI做到这一点

这是我的.travis.yml:

language: objective-c
xcode_workspace: "Mac Linux USB Loader.xcworkspace"
xcode_scheme: "Mac Linux USB Loader"
Run Code Online (Sandbox Code Playgroud)

这就是错误(我已经编写了许多以前引用Cocoapods的行,因为它们不相关:

Check dependencies
Code Sign error: No code signing identities found: No valid signing identities (i.e. certificate and private key pair) matching the team ID “T47PR9EQY5” were found.
Run Code Online (Sandbox Code Playgroud)

Mar*_*acz 17

您是否尝试在travis.yml上添加此内容:

language: objective-c

script:
  - xcodebuild [DEFAULT_OPTIONS] CODE_SIGNING_REQUIRED=NO
Run Code Online (Sandbox Code Playgroud)

或者导入开发(如果要在构建中使用,则分发)密钥链的证书/密钥并复制团队配置文件,以使代码签名工作.像这样:

language: objective-c

before_script:
- ./scripts/add-key.sh

script:
  - xcodebuild [DEFAULT_OPTIONS] CODE_SIGNING_REQUIRED=NO
Run Code Online (Sandbox Code Playgroud)

add-key.sh

#!/bin/sh

KEY_CHAIN=ios-build.keychain
security create-keychain -p travis $KEY_CHAIN
# Make the keychain the default so identities are found
security default-keychain -s $KEY_CHAIN
# Unlock the keychain
security unlock-keychain -p travis $KEY_CHAIN
# Set keychain locking timeout to 3600 seconds
security set-keychain-settings -t 3600 -u $KEY_CHAIN

# Add certificates to keychain and allow codesign to access them
security import ./scripts/certs/dist.cer -k $KEY_CHAIN -T /usr/bin/codesign
security import ./scripts/certs/dev.cer -k $KEY_CHAIN -T /usr/bin/codesign

security import ./scripts/certs/dist.p12 -k $KEY_CHAIN -P DISTRIBUTION_KEY_PASSWORD  -T /usr/bin/codesign
security import ./scripts/certs/dev.p12 -k $KEY_CHAIN -P DEVELOPMENT_KEY_PASSWORD  -T /usr/bin/codesign

echo "list keychains: "
security list-keychains
echo " ****** "

echo "find indentities keychains: "
security find-identity -p codesigning  ~/Library/Keychains/ios-build.keychain
echo " ****** "

# Put the provisioning profile in place
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles

cp "./scripts/profiles/iOSTeam_Provisioning_Profile_.mobileprovision" ~/Library/MobileDevice/Provisioning\ Profiles/
cp "./scripts/profiles/DISTRIBUTION_PROFILE_NAME.mobileprovision" ~/Library/MobileDevice/Provisioning\ Profiles/
Run Code Online (Sandbox Code Playgroud)


Kin*_*ard 11

当使用Xcode 7项目+ Swift + iOS 9 + travis-ci.org上提供的持续集成工具时,请在下面找到我的.travis.yml文件,该文件修复了此错误消息和其他错误消息:

# http://docs.travis-ci.com/user/languages/objective-c/
# https://github.com/facebook/xctool

language: objective-c

osx_image: xcode7

# xcode_project: SampleNotifcations/SampleNotifcations.xcodeproj
# xcode_workspace: SampleNotifcations/SampleNotifcations.xcworkspace

# xcode_scheme: SampleNotifcationsTests

podfile: SampleNotifcations/Podfile

# xcode_sdk: iphonesimulator9.0

script:

  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=NO

before_install:
  - brew update
  - brew uninstall xctool && brew install --HEAD xctool
Run Code Online (Sandbox Code Playgroud)

资料来源: