4

Jenkins iOS证书问题的解决方案

 3 years ago
source link: https://wuzhiwei.net/jenkins-ios/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Jenkins iOS证书问题的解决方案

Jenkins是一个强大的持续集成工具,我们用它来执行定时的出包和上传任务。然而在iOS的出包中,一旦涉及到Certificate和Provision profile的变更,自动出包任务总是会以失败而告终。

经过一番Google之后,我找到了Steve Zhang在2012年写的一篇文章:Fix the iOS code signing issue when using Jenkins。这篇文章讲述了常见的两个问题,并给出了解决方案。由于这篇文章写于6年以前,所以时效性略差,本文将在它的基础上进行补充和完善。

无法在keychain中找到有效证书和私钥

There are no valid certificate/private key pairs in the default keychain

打开钥匙串(Keychain Access),然后把登录(Login)那一栏的出包证书,右击拷贝,然后选中系统(System),将其粘贴过去。

Alt text

如果仍不行,进入Jenkins的管理页(Manage Jenkins),在Xcode Builder下将keychain的路径写为:${HOME}/Library/Keychains/login.keychain-db,同时写上打开密码。

Alt text

然后在出包项目的设置中,勾上自动unlock keychain。

Alt text

无法找到匹配的Provisioning profile

  • Provisioning profile 'xxx' can't be found
  • Provisioning profile 'xxx' doesn't include signing certificate "iPhone Developer: xxx"

Xcode 8.3之前的版本

所有在Mac上的Provision profile都存放在这个目录下:~/Library/MobileDevice/Provisioning Profiles。在Jenkins账户下,如果没有这个目录的话,则创建一个:/Users/Shared/Jenkins/Library/MobileDevice/Provisioning Profile。

先打开目录~/Library/MobileDevice/Provisioning Profile,将里面的所有老的Provision profile全部删除干净。

然后进Xcode -> Preferences -> 选中账户 -> 选中对应的Team -> Download Manual Profile。这样就把所有的profile下载到目录~/Library/MobileDevice/Provisioning Profile,再打开这个目录,复制刚刚下好的所有profile到Jenkins的profile目录/Users/Shared/Jenkins/Library/MobileDevice/Provisioning Profile下。

Alt text

Xcode 8.3之后的版本

如果你用的是Xcode 8.3以后的版本话,Xcode默认会自动帮你管理Provision profile(此处是坑)。

所以如果是标记为Automatically manage signning,打开Xcode的项目设置,在Bundle Identifier下先填好你出包的Bundle ID,选好Team,然后坐等Xcode自动帮你下一个最新的Provision profile。

Alt text

如果下载结束,你会在~/Library/MobileDevice/Provisioning Profile目录下发现一个新的profile,将其复制到Jenkins的profile目录/Users/Shared/Jenkins/Library/MobileDevice/Provisioning Profile下即可。

最近一整年都忙于工作,使得能分在博客上的时间少之又少。在2018年的末尾,写下这么一篇问题解决文章,个人并不是很满意。

如果能帮助到读者朋友们解决到问题,这是我所乐于看到的,也希望读者朋友们可以分享自己的经验。

Posted in Hello World, Problem solve Tagged iOS, Jenkins, Provision profile, 出包
关注微信公众号:timind
qrcode_for_gh_33e6647fd07a_258.jpg

One response

  1. f3085d21f285a7c2fbf472f6908be6e6?s=84&r=g开发者头条

    感谢分享!已推荐到《开发者头条》:https://toutiao.io/posts/q536b3 欢迎点赞支持!使用开发者头条 App 搜索 23583 即可订阅《游戏开发杂谈》

发表评论 取消回复

电子邮件地址不会被公开。 必填项已用*标注

评论

姓名 *

电子邮件 *

站点


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK