You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

CI机器(iMac)CodeSign报错:ARCHIVE FAILED,退出码65

iOS GitLab CI + Fastlane 打包签名失败(Exit status:65)解决指南

问题场景

在专用iMac CI机器上使用GitLab CI + Fastlane执行iOS应用构建任务,打包时出现签名失败报错:

** ARCHIVE FAILED **
The following build commands failed:

    CodeSign /var/root/Library/Developer/Xcode/DerivedData/XXXX-bjxxtxqovrbjgodpvbuyaspcfsfb/Build/Intermediates.noindex/ArchiveIntermediates/XXXXX/InstallationBuildProductsLocation/Applications/XXXX.app/Frameworks/Designables.framework (in target 'XXXXX' from project 'XXXXX')

Exit status: 65

已尝试解锁登录和系统钥匙串,CI机器上证书、描述文件配置齐全,Fastlane的distribute lane配置如下:

lane :distribute do
        build_ios_app(scheme: "xxxxx", workspace: "xxxxxx.xcworkspace", clean: true, export_method: "development", configuration: "Debug", export_options: {
signingStyle: "manual", compileBitcode: false, provisioningProfiles: { 
      "com.xxxxx" => "xxxxxxxProfile28Sept2022",
      "com.xxx.xxxxNotificationService" => "xxxxxxNotificationService28Sept2022"
    }})

解决办法

  • 检查Designables.framework的签名配置
    报错核心是这个framework签名失败,需确认:

    1. 打开Xcode工程,找到Designables.framework对应的target
    2. 进入Build Settings -> Signing,确认手动签名模式下,证书和描述文件与CI机器上安装的完全匹配
    3. 若为第三方framework,确保它本身已正确签名,或在你的工程中设置为Embed & Sign(需要重新签名时)
  • 修改衍生数据目录避免权限问题
    衍生数据存放在root目录导致权限受限,可在Fastlane中指定自定义衍生数据路径:

    lane :distribute do
            build_ios_app(
                scheme: "xxxxx", 
                workspace: "xxxxxx.xcworkspace", 
                clean: true, 
                export_method: "development", 
                configuration: "Debug", 
                derived_data_path: "./DerivedData", # 指定项目目录下的衍生数据文件夹
                export_options: {
                    signingStyle: "manual", 
                    compileBitcode: false, 
                    provisioningProfiles: { 
                        "com.xxxxx" => "xxxxxxxProfile28Sept2022",
                        "com.xxx.xxxxNotificationService" => "xxxxxxNotificationService28Sept2022"
                    }
                })
    

    这样衍生数据会存放在项目目录下,权限更易管控,也方便查看日志。

  • 完善钥匙串权限配置
    CI环境下仅解锁钥匙串可能不够,需补充以下命令(在Fastlane执行前添加):

    # 解锁钥匙串
    security unlock-keychain -p "$KEYCHAIN_PASSWORD" /Users/$(whoami)/Library/Keychains/login.keychain-db
    # 允许工具访问签名证书
    security set-key-partition-list -S apple-tool:,apple: -s -k "$KEYCHAIN_PASSWORD" /Users/$(whoami)/Library/Keychains/login.keychain-db
    

    替换$KEYCHAIN_PASSWORD为CI机器的钥匙串密码。

  • 补全Provisioning Profile配置
    确认export_options中的provisioningProfiles覆盖了所有需要签名的target,包括Designables.framework的bundle ID。如果该framework有独立的bundle ID,需添加对应条目指定匹配的描述文件。

  • 手动执行Xcode归档排查
    在CI机器上用相同的scheme、configuration手动执行Xcode归档,若同样失败,可排除Fastlane影响,直接定位Xcode签名设置或钥匙串问题。

内容的提问来源于stack exchange,提问作者Mohit Pareek

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.16 06:05:19