使用Github Actions+Fastlane上传RN应用至TestFlight遇Scheme配置错误
解决方案:xcodebuild: error: Scheme qa is not currently configured for the build action
针对你在GitHub Actions + Fastlane上传React Native应用到TestFlight时遇到的Scheme配置错误,以下是可行的修复方案:
1. 确认共享Scheme已提交至Git仓库
本地Xcode中共享Scheme后,会在ios/xcshareddata/xcschemes/目录下生成qa.xcscheme文件。检查该文件是否已添加到Git并提交,CI环境需要拉取到这个文件才能识别Scheme。
2. 改用Workspace而非Project构建
由于你使用了CocoaPods,Fastlane的build_app应该指定.xcworkspace而非.xcodeproj,否则可能无法识别通过CocoaPods关联的Scheme。修改Fastfile中的build_app配置:
build_app( workspace: "My.xcworkspace", # 替换原有的project参数 scheme: 'qa', clean: true, build_configuration: "Release", # 明确指定Release配置,匹配app-store导出方式 export_method: "app-store", export_options: { provisioningProfiles: { "myBundleId" => "myProfile" }, } )
3. 移除或调整recreate_schemes步骤
当前你在build前调用了recreate_schemes,这可能会覆盖已正确配置的共享Scheme。尝试注释掉该步骤:
# recreate_schemes(project: "My.xcodeproj")
如果确实需要重新生成Scheme,确保指定正确的Workspace而非Project:
recreate_schemes(workspace: "My.xcworkspace")
4. 统一Build Configuration配置
你在update_project_provisioning中指定了build_configuration: 'Debug',但导出方式是app-store(对应Release配置),这会导致配置不匹配。修改update_project_provisioning的配置:
update_project_provisioning( xcodeproj: 'My.xcodeproj', target_filter: 'github', profile: './profile.mobileprovision', build_configuration: 'Release' # 改为Release )
5. 验证CI环境中的Scheme可用性
在GitHub Actions的Execute Fastlane command步骤之前,添加一个调试步骤,列出当前环境下的所有Scheme,确认qa是否存在:
- name: List available schemes run: cd ios && xcodebuild -list
内容的提问来源于stack exchange,提问作者Rustam Hashymov
相关产品推荐
相关产品推荐

