1、主要配置如图
![2885354-bcaa02813b66bd18.png](https://i-blog.csdnimg.cn/blog_migrate/c8ba35b0b5f3b68acfd5cf77bfa6ceae.webp?x-image-process=image/format,png)
1.png
![2885354-ddb9a6e199f4596b.png](https://i-blog.csdnimg.cn/blog_migrate/e6b7c30af273cfecec1cae5a9ebf45a2.webp?x-image-process=image/format,png)
2.png
![2885354-0843df256020a096.png](https://i-blog.csdnimg.cn/blog_migrate/ede471c59de6a6c54b11cf86bcc3642b.webp?x-image-process=image/format,png)
3.png
![2885354-deba22f44c8fe32c.png](https://i-blog.csdnimg.cn/blog_migrate/d1d3e8ec59b8d78da252b63398a13dca.webp?x-image-process=image/format,png)
5.png
脚本:
#!/bin/bash
# 根据实际情况修改target和scheme名字
TARGET_NAME=${BUILD_NUMBER}
SCHEME_NAME="your scheme"
XCARCHIVE_NAME="your scarchive name"
# keychainPath="/Users/yourName/Library/Keychains/login.keychain"
#获取钥匙串和打包电脑密码
security unlock-keychain -p your-secret-key ${KEYCHAIN_PATH}
# clean
xcodebuild clean -target ${TARGET_NAME}.ipa -scheme ${SCHEME_NAME} -configuration Release
# build xcarchive
xcodebuild -workspace ${WORKSPACE}/${SCHEME_NAME}.xcworkspace -archivePath ${WORKSPACE}/${XCARCHIVE_NAME}.xcarchive -scheme ${SCHEME_NAME} -sdk iphoneos -configuration Release archive
# ipa
xcodebuild -exportArchive -exportOptionsPlist ${WORKSPACE}/exportPlist.plist -archivePath ${WORKSPACE}/${XCARCHIVE_NAME}.xcarchive -exportPath ${WORKSPACE}/${TARGET_NAME}.ipa -allowProvisioningUpdates
2、这样配置的原因
因为使用jenkins xcode插件时,一直出现"your session is expired",以为这种情况就不能使用此插件了。后换成了脚本...结果还是有上述报错。。
在/usr/local/Cellar/jenkins/2.124/homebrew.mxcl.jenkins.plist文件里添加上JENKINS_UER=root后,重启jenkins。。
此后,证书也认到了,session的问题也解决了。。