美文网首页上海快风信息科技有限公司iOS调试技巧iOS备忘录
使用 Jenkins 持续集成 iOS 项目时碰到的一些问题

使用 Jenkins 持续集成 iOS 项目时碰到的一些问题

作者: 93b3d3ccb7e6 | 来源:发表于2017-06-02 18:22 被阅读1781次

学习 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.如图配置开发证书:
WX20170602-174826@2x.png WX20170602-174713@2x.png
  • 3.配置完证书之后,需提交代码到 Git 远程仓库,确保 Jenkins 构建时能获取最新的证书配置

还要确保已经将 /Users/管理员用户名/LibraryMobileDevice 文件夹拷贝到了 /Users/Shared/Jenkins/Library 下面


Q2

FATAL: No global development team or local team ID was configured.

A2

  • Team ID 在这里填写,如图:
WX20170602-181236.png

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

WX20170602-181556@2x.png

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 :
WX20170605-103630@2x.png
  • 2.填写 Code Signing Identity :
WX20170605-104534@2x.png
  • 3.重新上传 mobileprovision 文件并填写 Provisioning Profiles Directory Path :
WX20170605-103525@2x.png
  • 4.点击 Save 按钮

Password 是 Mac 开机时输入的密码

  • 5.重新配置项目,如图:
WX20170605-105813@2x.png WX20170605-105837@2x.png WX20170605-105928@2x.png WX20170605-105955@2x.png

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/管理员用户名/LibraryMobileDevice 文件夹拷贝到 /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 之前,如图:

WX20170605-170913.png

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

如图:

WX20170605-173713@2x.png

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 文件夹的读写权限
WX20170606-151737@2x.png

我研究了 Jenkins 3天左右,期间构建项目失败了40多次,内心几近崩溃 😂😂😂
而第一次构建项目成功并看到打包的IPA之后,心里却十分淡然...

相关文章

网友评论

  • WQiOS:hello,后来你的fastlane: command not found 这个问题解决了吗?我也是出现这个问题,搜了很多资料,还是没解决好。如果你解决了,不知道你有没有空,请不吝赐教:grin:
    93b3d3ccb7e6:sorry,这个我也没搞好。
  • 一号线:老哥!
    FATAL: No global development team or local team ID was configured.
    这个问题,公司发的企业证书没有你截图说中括号中的一段文字。。那这个team我咋整啊。
    93b3d3ccb7e6:sorry,我没用过企业证书,只能你自己去摸索了。
    一号线:https://stackoverflow.com/questions/43873161/jenkins-ios-app-getting-failed-fatal-no-global-development-team-or-local-team-i
    好像必须要配置这个team啊
  • 道长_0d42:楼主 我配jenkins的时候也有一个棘手问题
    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里就可以执行。

    楼主有良策么?
    93b3d3ccb7e6:sorry,现在才看到,我没有用 xcode 的 command 在 jenkins 里面写过 shell,你可以看看完整的教程对比一下:http://www.jianshu.com/p/13e34671788f
  • DamonYYB:我遇到你的Q4问题 该怎么解决呢
    93b3d3ccb7e6:@DamonYYB ld: library not found for -lMJRefresh 这个错误是用 xcode 编译时出现的,还是使用 Jenkins 构建时出现的?
    DamonYYB:@书中觅宝 我本地xcode 改成手动签名 就好了 出现了新的错误 ld: library not found for -lMJRefresh
    clang: error: linker command failed with exit code 1 (use -v to see invocation) 但是我已经pod install 了呀
    93b3d3ccb7e6:试试将 /Users/管理员用户名/Library 的 MobileDevice 文件夹拷贝到 /Users/Shared/Jenkins/Library 下面
  • 3c446647e9d1:求完整教程
    93b3d3ccb7e6:http://www.jianshu.com/p/13e34671788f
  • 黑黝黝的搬砖王:楼主你好,我也遇到第一个问题了,但是你说的所有步骤我都做了,但是错误还是存在,这个问题我已经卡在这里好几天了,我之前Jenkins是已经配置好了,也能正常打包了,这周一远程服务器ip换了一下,Jenkins重启之后就出现这个问题了,一直解决不了,求解。
    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 **
    一抹相思泪成雨:@MeSimon 请问你解决了没有??
    93b3d3ccb7e6:那也许只能重新安装Jenkins试一下
  • Zd_silent:楼主你好,我遇到如下问题,不知道你是否知道如何解决
    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 **
    93b3d3ccb7e6:https://github.com/fastlane/fastlane/issues/9380 你自己看吧

本文标题:使用 Jenkins 持续集成 iOS 项目时碰到的一些问题

本文链接:https://www.haomeiwen.com/subject/kqvufxtx.html