学习 Jenkins 时遇到很多的坑。。。把这些问题记录下来,避免再犯。
Q1
No iOS profile matching '8xxxxxx3@qq.com/yoxxxhu_Distribution' found: Xcode couldn't find a profile
matching '8xxxxxx3@qq.com/yoxxxhu_Distribution'. Install the profile (by dragging and dropping it onto
Xcode's dock item) or select a different one in the General tab of the target editor.
Code signing is required for product type 'Application' in SDK 'iOS 10.3'
A1
- 1.用 Xcode 打开 iOS 项目,在 【TARGETS】 - 【General】 中不勾选
Automatically manage signing
- 2.如图配置开发证书:


- 3.配置完证书之后,需提交代码到 Git 远程仓库,确保 Jenkins 构建时能获取最新的证书配置
还要确保已经将 /Users/管理员用户名/Library 的 MobileDevice 文件夹拷贝到了 /Users/Shared/Jenkins/Library 下面
Q2
FATAL: No global development team or local team ID was configured.
A2
- Team ID 在这里填写,如图:

Team ID 应填写这串字符,如图:

Q3
error: exportArchive: No valid iOS Development signing identities belonging to team CxxxxxxxxF were found.
Error Domain=IDEDistributionErrorDomain Code=1 "No valid iOS Development signing identities
belonging to team CxxxxxxxxF were found."
UserInfo={NSLocalizedDescription=No valid iOS Development signing identities
belonging to team CxxxxxxxxF were found.}
A3
- 1.在 Jenkins - 【系统管理】 - 【Keychains and Provisioning Profiles Management】中重新上传 login.keychain :

- 2.填写 Code Signing Identity :

- 3.重新上传 mobileprovision 文件并填写 Provisioning Profiles Directory Path :

- 4.点击 Save 按钮
Password 是 Mac 开机时输入的密码
- 5.重新配置项目,如图:




Q4
No profiles for 'com.Gxxxxxc.SxxxM' were found: Xcode couldn't find a
provisioning profile matching 'com.Gxxxxxc.SxxxM'.
Code signing is required for product type 'Application' in SDK 'iOS 10.3'
A4
将 /Users/管理员用户名/Library 的 MobileDevice 文件夹拷贝到 /Users/Shared/Jenkins/Library 下面
Q5
执行自动上传IPA到蒲公英的脚本时出错 fastlane: command not found
[H20170531_OCUnit] $ /bin/sh -xe /var/folders/9d/jrxjl4_14tj1w33z34jkrxjm0000gn/T/hudson4176251309376324428.sh
+ IPANAME=H20170531_OCUnit
+ fastlane gym --export_method ad-hoc --output_name H20170531_OCUnit
/var/folders/9d/jrxjl4_14tj1w33z34jkrxjm0000gn/T/hudson4176251309376324428.sh:
line 3: fastlane: command not found
Build step 'Execute shell' marked build as failure
Finished: FAILURE
A5
蒲公英 - 文档中心的解答:
这个情况一般是由于 jenkins 没有设置正确的 $PATH 环境变量导致的。正确设置的方法为:
- 1.在命令行下执行 echo $PATH,记录下输出的结果
- 2.在 jenkins 中系统管理-系统设置中,找到 环境变量(Environment variables)
- 3.在 key 中填写 $PATH,在 value 中填写第一步中输出的结果
- 4.保存即可
蒲公英 - 文档中心链接: https://www.pgyer.com/doc/view/jenkins_ios
- 但是我按照蒲公英的方法操作之后,还是报这个错误 fastlane: command not found
- 待解决 ...
Q6
Check dependencies
The file “Pods-Swarm_swift.release.xcconfig” couldn’t be opened because there is no such file.
(/Users/HW/.jenkins/workspace/SWARM/Pods/Target Support Files/Pods-Swarm_swift/Pods-Swarm_swift.release.xcconfig)
------
diff: /../Podfile.lock: No such file or directory
diff: /Manifest.lock: No such file or directory
error: The sandbox is not in sync with the Podfile.lock.
Run 'pod install' or update your CocoaPods installation.
** ARCHIVE FAILED **
The following build commands failed:
PhaseScriptExecution [CP]\ Check\ Pods\ Manifest.lock /Users/HW/Library/Developer/Xcode/
DerivedData/Swarm_swift-gttgnsxyltckdlfnjucunmsdhnyx/Build/Intermediates/ArchiveIntermediates/
Swarm_swift/IntermediateBuildFilesPath/Swarm_swift.build/Release-iphoneos/Swarm_swift.build/
Script-E66BF0AC51C3B26C2CF625AA.sh
A6
- 在构建中添加 pod install 脚本:
#!/bin/bash -l
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
pod install --verbose --no-repo-update
此 shell 脚本要放在 Xcode 之前,如图:

Q7
iOS 项目使用了 Cocoapods 时,执行 pod install
脚本报错:pod: command not found
+ pod install --verbose --no-repo-update
/var/folders/9d/jrxjl4_14tj1w33z34jkrxjm0000gn/T/hudson943803671821413828.sh: line 5:
pod: command not found
Build step 'Execute shell' marked build as failure
A7
修改 shell 脚本如下:
#!/bin/bash -l
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
pod install --verbose --no-repo-update
export 语句将控制台语言环境设置为 UTF-8 格式,避免出现 Podfile 文件打开错误。
Q8
ERROR: Timeout after 10 minutes
ERROR: Error cloning remote repo 'origin'
A8
如图:

Q9
FATAL: Failed to copy /Users/Shared/Jenkins/Home/kpp_upload/SWARM_Development.mobileprovision to
/Users/HW/Library/MobileDevice/Provisioning Profiles/54xxxxxxxxxxd4.mobileprovision
java.io.FileNotFoundException:
/Users/HW/Library/MobileDevice/Provisioning Profiles/54xxxxxxxxxxd4.mobileprovision
A9
- 开放
/Users/HW/Library/MobileDevice/Provisioning\ Profiles
文件夹的读写权限

我研究了 Jenkins 3天左右,期间构建项目失败了40多次,内心几近崩溃 😂😂😂
而第一次构建项目成功并看到打包的IPA之后,心里却十分淡然...
网友评论
FATAL: No global development team or local team ID was configured.
这个问题,公司发的企业证书没有你截图说中括号中的一段文字。。那这个team我咋整啊。
好像必须要配置这个team啊
Check dependencies
[BCEROR]No profiles for 'com.xxx.ngame' were found: Xcode couldn't find a provisioning profile matching 'com.xxx.ngame'.
[BCEROR]Code signing is required for product type 'Application' in SDK 'iOS 10.2'
我用的xcode的command在jenkins里直接写的shell
xcodebuild -project /Users/Shared/Jenkins/Home/jobs/jenkinstest/workspace/default/ci/jenkinsios/Unity-iPhone.xcodeproj -scheme Unity-iPhone -sdk "iphoneos10.2" archive -archivePath /Users/Shared/Jenkins/Home/jobs/jenkinstest/workspace/default/ci/jenkinsios/build/Release-iphoneos/ngame.xcarchive
这句话在jenkins里就报上面的错误,在系统terminal里就可以执行。
楼主有良策么?
clang: error: linker command failed with exit code 1 (use -v to see invocation) 但是我已经pod install 了呀
Check dependencies
No profile matching 'qsxt_apns_dev_provisioning_profiles' found: Xcode couldn't find a profile matching 'qsxt_apns_dev_provisioning_profiles'. Install the profile (by dragging and dropping it onto Xcode's dock item) or select a different one in the General tab of the target editor.
Code signing is required for product type 'Application' in SDK 'iOS 10.2'
** BUILD FAILED **
Error Domain=IDEProvisioningErrorDomain Code=9 ""Mortgage.app" requires a provisioning profile." UserInfo={NSLocalizedDescription="Mortgage.app" requires a provisioning profile., NSLocalizedRecoverySuggestion=Select a provisioning profile for the "Default" build configuration in the project editor.}
** EXPORT FAILED **