gpt4 book ai didi

xcode - Travis CI 无法构建并出现代码签名错误

转载 作者:行者123 更新时间:2023-12-01 17:45:43 24 4
gpt4 key购买 nike

Travis CI 无法构建我的应用程序,因为 Xcode 项目设置为需要代码签名,而 Travis 没有我的证书。我可以通过禁用代码签名来解决此问题,但沙箱和权利将不起作用。我知道通常从命令行构建时,您可以将 CODE_SIGN_IDENTITY=""CODE_SIGNING_REQUIRED=NO 传递给 xcodebuild 来禁用代码签名,但是你该怎么做这是 Travis CI 中的

这是我的.travis.yml:

language: objective-c
xcode_workspace: "Mac Linux USB Loader.xcworkspace"
xcode_scheme: "Mac Linux USB Loader"

这是错误(我已经编写了许多先前引用 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.

最佳答案

您是否尝试将其添加到 travis.yml 上:

language: objective-c

script:
- xcodebuild [DEFAULT_OPTIONS] CODE_SIGNING_REQUIRED=NO

或者将开发(以及分发,如果您要在构建中使用)证书/ key 导入到钥匙串(keychain)并复制您的团队配置文件,以使代码签名工作。像这样:

language: objective-c

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

script:
- xcodebuild [DEFAULT_OPTIONS] CODE_SIGNING_REQUIRED=NO

添加 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/

关于xcode - Travis CI 无法构建并出现代码签名错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27671854/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com