iOS Fastlane流水线DEV环境Firebase分发失败:Bundle ID不匹配
问题:DEV环境Fastlane Firebase分发失败(Bundle ID不匹配)
问题描述
- iOS应用在DEV环境触发Fastlane流水线向Firebase分发时失败,生产/Ad-hoc环境可正常完成Firebase分发。
- 执行命令:
firebase_app_distribution - 错误提示:
IPA的Bundle ID 'com.myapp.xxx'与Firebase应用的Bundle ID 'com.myapp1.xxx'不匹配,需修改后重试或上传至对应Firebase应用。
Fastfile相关代码
export_methods.each { |export_method| gym( archive_path: archive_path, skip_build_archive: true, output_name: "xxx.ipa", export_method: export_method, build_path: ".../builds", output_directory: ".../builds", scheme: scheme, xcargs: '-allowProvisioningUpdates -disableAutomaticPackageResolution' + authentication_key, skip_package_dependencies_resolution: true ) case export_method when "ad-hoc", "development" firebase_app_distribution( # Fix Tester groups # Could not enable access for testers. firebase_cli_token: ENV["FIREBASE_TOKEN"], app: ENV['FIREBASE_APP_ID'], groups: ENV['FIREBASE_TESTER_GROUP'], release_notes: release_notes, ipa_path: ".../builds/xxx.ipa", debug: true ) when "app-store" pilot( api_key: api_key, skip_submission: true, skip_waiting_for_build_processing: true ) else UI.message "unknonw export method #{export_method}, not uploading" end }
完整错误日志
App Distribution halted because it had a problem uploading the IPA.: There's been an error processing your upload. The IPA bundle ID 'com.myapp.xxx' does not match your Firebase app's bundle ID 'com.myapp1.xxx'. Change the IPA bundle ID to com.myapp1.xxx and retry the upload. If a Firebase app already exists for 'com.myapp.xxx', upload your IPA to that Firebase app instead. INFO [2024-07-08 12:01:20.43]: Successfully generated documentation at path '/xxx/ios/s/fastlane/README.md' +------------------------------------------------+ | fastlane summary | +------+---------------------------+-------------+ | Step | Action | Time (in s) | +------+---------------------------+-------------+ | 1 | cocoapods | 91 | | 2 | app_store_connect_api_key | 0 | | 3 | gym | 210 | | 4 | gym | 14 | | 💥 | firebase_app_distribution | 7 | | | +------+---------------------------+-------------+ DEBUG [2024-07-08 12:01:20.64]: All plugins are up to date ERROR [2024-07-08 12:01:20.64]: fastlane finished with errors DEBUG [2024-07-08 12:01:20.64]: All plugins are up to date bundler: failed to load command: fastlane (/Users/runner/hostedtoolcache/Ruby/3.1.6/x64/bin/fastlane) /Users/runner/hostedtoolcache/Ruby/3.1.6/x64/lib/ruby/gems/3.1.0/gems/fastlane 2.221.1/fastlane_core/lib/fastlane_core/ui/interface.rb:141:in `user_error!': \e[31m[!] App Distribution halted because it had a problem uploading the IPA.: There's been an error processing your upload. (FastlaneCore::Interface::FastlaneError) The IPA bundle ID 'com.myapp.xxx' does not match your Firebase app's bundle ID 'com.myapp1.xxx'. Change the IPAbundle ID to com.myapp1.xxx and retry the upload.> from /Users/runner/hostedtoolcache/Ruby/3.1.6/x64/lib/ruby/gems/3.1.0/gems/fastlane-2.221.1/fastlane/lib/fastlane/command_line_handler.rb:34:in `handle' from /Users/runner/hostedtoolcache/Ruby/3.1.6/x64/lib/ruby/gems/3.1.0/gems/fastlane-2.221.1/fastlane/lib/fastlane/commands_generator.rb:110:in `block (2 levels) in run' from /Users/runner/hostedtoolcache/Ruby/3.1.6/x64/lib/ruby/gems/3.1.0/gems/commander-4.6.0/lib/commander/command.rb:187:in `call' from /Users/runner/hostedtoolcache/Ruby/3.1.6/x64/lib/ruby/gems/3.1.0/gems/commander-4.6.0/lib/commander/command.rb:157:in `run' from /Users/runner/hostedtoolcache/Ruby/3.1.6/x64/lib/ruby/gems/3.1.0/gems/commander-4.6.0/lib/commander/runner.rb:444:in `run_active_command' from /Users/runner/hostedtoolcache/Ruby/3.1.6/x64/lib/ruby/gems/3.1.0/gems/fastlane-2.221.1/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb:124:in `run!' from /Users/runner/hostedtoolcache/Ruby/3.1.6/x64/lib/ruby/gems/3.1.0/gems/commander-4.6.0/lib/commander/delegates.rb:18:in `run!' from /Users/runner/hostedtoolcache/Ruby/3.1.6/x64/lib/ruby/gems/3.1.0/gems/fastlane-2.221.1/fastlane/lib/fastlane/commands_generator.rb:363:in `run' from /Users/runner/hostedtoolcache/Ruby/3.1.6/x64/lib/ruby/gems/3.1.0/gems/fastlane-2.221.1/fastlane/lib/fastlane/commands_generator.rb:43:in `start' from /Users/runner/hostedtoolcache/Ruby/3.1.6/x64/lib/ruby/gems/3.1.0/gems/fastlane-2.221.1/fastlane/lib/fastlane/cli_tools_distributor.rb:123:in `take_off' from /Users/runner/hostedtoolcache/Ruby/3.1.6/x64/lib/ruby/gems/3.1.0/gems/fastlane-2.221.1/bin/fastlane:23:in `<top (required)>' from /Users/runner/hostedtoolcache/Ruby/3.1.6/x64/bin/fastlane:25:in `load' from /Users/runner/hostedtoolcache/Ruby/3.1.6/x64/bin/fastlane:25:in `<top (required)>' from /Users/runner/hostedtoolcache/Ruby/3.1.6/x64/lib/ruby/3.1.0/bundler/cli/exec.rb:58:in `load' from /Users/runner/hostedtoolcache/Ruby/3.1.6/x64/lib/ruby/3.1.0/bundler/cli/exec.rb:58:in `kernel_load' from /Users/runner/hostedtoolcache/Ruby/3.1.6/x64/lib/ruby/3.1.0/bundler/cli/exec.rb:23:in `run' from /Users/runner/hostedtoolcache/Ruby/3.1.6/x64/lib/ruby/3.1.0/bundler/cli.rb:486:in `exec' from /Users/runner/hostedtoolcache/Ruby/3.1.6/x64/lib/ruby/3.1.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run' from /Users/runner/hostedtoolcache/Ruby/3.1.6/x64/lib/ruby/3.1.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command' from /Users/runner/hostedtoolcache/Ruby/3.1.6/x64/lib/ruby/3.1.0/bundler/vendor/thor/lib/thor.rb:392:in `dispatch' from /Users/runner/hostedtoolcache/Ruby/3.1.6/x64/lib/ruby/3.1.0/bundler/cli.rb:31:in `dispatch' from /Users/runner/hostedtoolcache/Ruby/3.1.6/x64/lib/ruby/3.1.0/bundler/vendor/thor/lib/thor/base.rb:485:in `start' from /Users/runner/hostedtoolcache/Ruby/3.1.6/x64/lib/ruby/3.1.0/bundler/cli.rb:25:in `start' from /Users/runner/hostedtoolcache/Ruby/3.1.6/x64/lib/ruby/gems/3.1.0/gems/bundler-2.3.27/libexec/bundle:48:in `block in <top (required)>' from /Users/runner/hostedtoolcache/Ruby/3.1.6/x64/lib/ruby/3.1.0/bundler/friendly_errors.rb:120:in `with_friendly_errors' from /Users/runner/hostedtoolcache/Ruby/3.1.6/x64/lib/ruby/gems/3.1.0/gems/bundler-2.3.27/libexec/bundle:36:in `<top (required)>' from /Users/runner/hostedtoolcache/Ruby/3.1.6/x64/bin/bundle:25:in `load' from /Users/runner/hostedtoolcache/Ruby/3.1.6/x64/bin/bundle:25:in `<main>' ##[error]Bash exited with code '1'. Finishing: Build
解决方案
- 修正环境变量的Firebase App ID:DEV环境下,
ENV['FIREBASE_APP_ID']当前指向的Firebase应用Bundle ID是com.myapp1.xxx,但DEV构建的IPA Bundle ID是com.myapp.xxx,需要将DEV环境的FIREBASE_APP_ID替换为对应com.myapp.xxx的Firebase应用ID。 - 区分环境配置Firebase参数:修改Fastfile,根据构建环境加载不同的Firebase配置,示例代码:
export_methods.each { |export_method| gym( # 原gym参数不变... ) case export_method when "ad-hoc", "development" # 根据环境变量判断使用哪个Firebase App ID firebase_app_id = ENV['BUILD_ENV'] == 'dev' ? ENV['FIREBASE_APP_ID_DEV'] : ENV['FIREBASE_APP_ID_PROD'] firebase_app_distribution( firebase_cli_token: ENV["FIREBASE_TOKEN"], app: firebase_app_id, groups: ENV['FIREBASE_TESTER_GROUP'], release_notes: release_notes, ipa_path: ".../builds/xxx.ipa", debug: true ) # 其他case不变... end } - 验证IPA的Bundle ID:确认DEV构建的IPA实际Bundle ID,可通过命令
xcrun altool --validate-app -f ".../builds/xxx.ipa" -t ios查看,同时检查Xcode中DEV scheme对应的项目Bundle ID配置是否正确。 - Firebase控制台配置检查:登录Firebase控制台,确认是否存在Bundle ID为
com.myapp.xxx的应用。若存在,直接使用该应用的ID作为DEV环境的FIREBASE_APP_ID;若不存在,可创建对应Bundle ID的Firebase应用,或调整DEV构建的IPA Bundle ID以匹配现有Firebase应用。
内容的提问来源于stack exchange,提问作者SaravanaKumar_TEL
相关产品推荐
相关产品推荐

