Xcode Cloud 配置云打包
2023-06-26 本文已影响0人
follow_er
Xcode Cloud保姆级教学
介绍Xcode Cloud
xcode cloud 是苹果官方推出的云打包工具,省时省力,且隐私安全。可以帮开发者自动发布到TestFlight或者AppStore,打包信息可以通知到群内。可以在build时、打包前,打包后调用自定义脚本。
xcode cloud 打包每月有25小时的免费使用时间,目前的订阅加个如图。

但是要使用xcode需要满足3个条件,个人免费开发者目前是无法使用的,必须是团队开发,且app已经发布到App Store Connect,是testFlight 也可以。
- 加入Apple 开发者计划。
- 在 Xcode 设置的“帐户”下添加您的 Apple ID。
-
在App Store Connect中拥有您的应用程序的应用程序记录,或者拥有创建应用程序所需的角色或权限。
要创建应用程序记录,您必须拥有 Apple 开发人员团队的应用程序管理员、管理员或帐户持有者角色。如果您具有开发人员角色,则需要创建应用程序权限。
配置Xcode Cloud
如果符合身份要求就可以配置Xcode Cloud的 workflow了

选择识别出来的工程,可能有多个,选择你想配置的打包工程。

配置打包参数
General

Environment :
Xcode Version 和 macOS Version: 对于内部测试官方建议选用Latest Release,可以帮你更早的发现问题,而发布的Release版本还是建议使用固定好的版本,防止出现奇怪的问题。
clean:也是在发布Release版本的时候打开,防止缓存问题。测试的时候不勾选,可以加快很多的速度。
Start Conditions的配置


设定时间表打包

Action的介绍




Post-Actions通知


这些配置好就可以等自动打包或手动到Product打包

打包后可以查看自己的打包记录了

可以查看打包log以及错误信息

顺便提一下,'xcode cloud we received too many api requests for this api key in the past 60 seconds. please wait and try again.' 这个错误稍等会即可,是apple网络问题。有时候还会出现http504的报错。

在APP Stroe Connect 中也可以看到记录和管理

构建失败也可以查到对应的生成文件下载使用

自定义脚本
一定要在工程目录下,且一定要目录名和文件名一致,内部的脚步写自己想要实现的功能即可,比如替换APP图标或者build成功后发送到钉钉,当然后面这个功能也可以使用web channel 进行设置

Xcode Cloud 官方文档地址: https://developer.apple.com/documentation/xcode/xcode-cloud