Fastlane导出iOS归档文件无限挂起问题排查
问题场景
近期Apple证书过期,更新证书和Provisioning Profile后采用Fastlane+Match(GitHub存储)方案,Fastfile配置如下:
fastlane_version '2.216.0' platform :ios do desc 'Fetch certificates and provisioning profiles' lane :certificates do match(app_identifier: 'com.quietmobile', type: 'appstore', readonly: true) end desc 'Build the iOS application.' lane :build do certificates gym end end
归档成功后,执行gym导出归档时无限挂起;手动执行导出命令同样卡住,添加sudo后提示:
error: exportArchive: No "iOS App Store" profiles for team 'Zbay LLC' matching 'match AppStore com.quietmobile' are installed.
已确认Match生成的证书已安装,Xcode中Release签名配置设置正确,怀疑问题出在签名配置本身。环境信息:Fastlane 2.216.0、Xcode 14.3.1、macOS Ventura 13.4.1。
排查解决步骤
调整Match的readonly模式
当前match使用readonly: true,仅拉取远程配置但不会安装到本地。刚更新证书后,先去掉该参数,执行fastlane certificates重新安装配置文件,之后按需改回readonly模式。验证本地配置文件状态
打开~/Library/MobileDevice/Provisioning Profiles,检查是否存在名称为match AppStore com.quietmobile的配置文件,且Team ID与Zbay LLC一致。若不存在,执行不带readonly参数的match命令重新生成安装;若存在,确认配置文件有效期、App ID与项目匹配。禁止用sudo执行Fastlane命令
sudo会切换到root用户环境,而Match安装的证书、配置文件存储在当前用户目录下,root无法访问该路径,必然导致签名资源找不到。所有Fastlane相关命令必须以当前用户身份执行。强制gym指定配置文件
在gym命令中显式指定签名配置,避免Xcode自动匹配出错,修改build lane如下:lane :build do certificates gym( export_options: { provisioningProfiles: { "com.quietmobile" => "match AppStore com.quietmobile" } } ) end清理Xcode签名缓存
- 关闭Xcode,删除
~/Library/Developer/Xcode/DerivedData下所有内容 - 打开Xcode进入
Xcode > Settings > Accounts,选中对应Team后点击Download Manual Profiles - 若问题仍存在,可执行
fastlane match nuke appstore(谨慎操作:会删除远程存储的所有AppStore签名资源),之后重新执行match appstore生成新的证书和配置文件。
- 关闭Xcode,删除
检查Xcode签名配置细节
进入项目Target > Signing & Capabilities > Release配置:- 确认
Automatically manage signing已关闭(使用Match需手动管理签名) Provisioning Profile选择match AppStore com.quietmobileSigning Certificate选择Match生成的对应证书
- 确认
内容的提问来源于stack exchange,提问作者Siepraa

