fastlane打包至TestFlight时归档失败求助(配置未变更)
解决Fastlane归档TestFlight失败问题
之前可正常运行的Fastlane配置未做任何修改,近期执行打包上传TestFlight操作时,归档环节失败,报错信息如下:
[15:42:40]: ▸ Run script build phase 'Start Packager' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'app' from project 'app') [15:42:40]: ▸ Run script build phase 'Bundle React Native code and images' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'app' from project 'app') [15:42:40]: ▸ Run script build phase '[CP] Embed Pods Frameworks' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'app' from project 'app') [15:42:40]: ▸ ** ARCHIVE FAILED ** [15:42:40]: Exit status: 65
当前使用的Fastlane配置:
desc "Push a new beta build to TestFlight" lane :beta do increment_build_number(xcodeproj: "app.xcodeproj") #sync_code_signing build_app(workspace: "app.xcworkspace", scheme: "app", export_options: { provisioningProfiles: { "com.app.app" => "vahStoreProf", } }, xcargs: "-allowProvisioningUpdates") # Changed to update_code_signing_settings from enable_automatic_code_signing since it was deprecated update_code_signing_settings(path: "app.xcodeproj") upload_to_testflight end
解决方法
方法1:消除脚本阶段的依赖分析警告
- 打开Xcode,定位到项目的
apptarget,进入Build Phases页面 - 分别找到
Start Packager、Bundle React Native code and images、[CP] Embed Pods Frameworks三个脚本阶段 - 对每个脚本,取消勾选Based on dependency analysis选项,让脚本在每次构建时强制执行
- 保存项目后重新运行Fastlane的
betalane
方法2:调整Fastlane任务执行顺序
当前update_code_signing_settings在build_app之后执行,会导致构建时签名配置未提前生效,调整顺序后再尝试:
desc "Push a new beta build to TestFlight" lane :beta do increment_build_number(xcodeproj: "app.xcodeproj") # 先更新签名配置,再执行构建 update_code_signing_settings(path: "app.xcodeproj") build_app(workspace: "app.xcworkspace", scheme: "app", export_options: { provisioningProfiles: { "com.app.app" => "vahStoreProf", } }, xcargs: "-allowProvisioningUpdates") upload_to_testflight end
方法3:为脚本阶段添加输出依赖(更规范的方式)
如果不想取消依赖分析,可以给每个脚本指定输出文件,让Xcode能正确判断是否需要执行脚本:
- 针对
Bundle React Native code and images,添加输出文件:$(BUILT_PRODUCTS_DIR)/$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/main.jsbundle - 针对
[CP] Embed Pods Frameworks,添加Pods框架的输出路径,比如$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/下的对应框架文件 - 针对
Start Packager,可以添加临时标记文件作为输出,比如$(TEMP_DIR)/packager_started.mark
内容的提问来源于stack exchange,提问作者Jukka Koivu
相关产品推荐
相关产品推荐

