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

fastlane 2.212.2上传App Store时出现undefined method `first'错误求助

Fastlane upload_to_app_store 报错:undefined method `first' for nil:NilClass (NoMethodError)

问题详情

  • Fastlane版本:已更新至2.212.2
  • 失败场景:执行upload_to_app_store上传App至App Store时失败
  • 核心报错:因app_price档位逻辑触发空指针错误,关键提示:
    undefined method `first' for nil:NilClass (NoMethodError)
    

完整执行日志

+------+-----------------------------------------+-------------+
|                       fastlane summary                       |
+------+-----------------------------------------+-------------+
| Step | Action                                  | Time (in s) |
+------+-----------------------------------------+-------------+
| 1    | default_platform                        | 0           |
| 2    | update_code_signing_settings            | 0           |
| 3    | update_project_team                     | 0           |
| 4    | match                                   | 13          |
| 5    | build_app                               | 27          |
| 6    | upload_app_privacy_details_to_app_store | 41          |
| 💥   | upload_to_app_store                     | 15          |
+------+-----------------------------------------+-------------+

[16:23:51]: fastlane finished with errors

🔗  You can ⌘ + double-click on links to open them directly in your browser.
/opt/homebrew/Cellar/fastlane/2.212.2/libexec/gems/fastlane-2.212.2/deliver/lib/deliver/upload_price_tier.rb:24:in `upload': \e[31m[!] undefined method `first' for nil:NilClass (NoMethodError)

      if app_prices.first
                   ^^^^^^\e[0m
    from /opt/homebrew/Cellar/fastlane/2.212.2/libexec/gems/fastlane-2.212.2/deliver/lib/deliver/runner.rb:161:in `upload_metadata'
    from /opt/homebrew/Cellar/fastlane/2.212.2/libexec/gems/fastlane-2.212.2/deliver/lib/deliver/runner.rb:61:in `run'
    from /opt/homebrew/Cellar/fastlane/2.212.2/libexec/gems/fastlane-2.212.2/fastlane/lib/fastlane/actions/upload_to_app_store.rb:22:in `run'
    from /opt/homebrew/Cellar/fastlane/2.212.2/libexec/gems/fastlane-2.212.2/fastlane/lib/fastlane/runner.rb:263:in `block (2 levels) in execute_action'
    from /opt/homebrew/Cellar/fastlane/2.212.2/libexec/gems/fastlane-2.212.2/fastlane/lib/fastlane/actions/actions_helper.rb:69:in `execute_action'
    from /opt/homebrew/Cellar/fastlane/2.212.2/libexec/gems/fastlane-2.212.2/fastlane/lib/fastlane/runner.rb:255:in `block in execute_action'
    from /opt/homebrew/Cellar/fastlane/2.212.2/libexec/gems/fastlane-2.212.2/fastlane/lib/fastlane/runner.rb:229:in `chdir'
    from /opt/homebrew/Cellar/fastlane/2.212.2/libexec/gems/fastlane-2.212.2/fastlane/lib/fastlane/runner.rb:229:in `execute_action'
    from /opt/homebrew/Cellar/fastlane/2.212.2/libexec/gems/fastlane-2.212.2/fastlane/lib/fastlane/runner.rb:157:in `trigger_action_by_name'
    from /opt/homebrew/Cellar/fastlane/2.212.2/libexec/gems/fastlane-2.212.2/fastlane/lib/fastlane/fast_file.rb:159:in `method_missing'
    from Fastfile:38:in `block (2 levels) in parsing_binding'
    from /opt/homebrew/Cellar/fastlane/2.212.2/libexec/gems/fastlane-2.212.2/fastlane/lib/fastlane/lane.rb:33:in `call'
    from /opt/homebrew/Cellar/fastlane/2.212.2/libexec/gems/fastlane-2.212.2/fastlane/lib/fastlane/runner.rb:49:in `block in execute'
    from /opt/homebrew/Cellar/fastlane/2.212.2/libexec/gems/fastlane-2.212.2/fastlane/lib/fastlane/runner.rb:45:in `chdir'
    from /opt/homebrew/Cellar/fastlane/2.212.2/libexec/gems/fastlane-2.212.2/fastlane/lib/fastlane/runner.rb:45:in `execute'
    from /opt/homebrew/Cellar/fastlane/2.212.2/libexec/gems/fastlane-2.212.2/fastlane/lib/fastlane/lane_manager.rb:47:in `cruise_lane'
    from /opt/homebrew/Cellar/fastlane/2.212.2/libexec/gems/fastlane-2.212.2/fastlane/lib/fastlane/command_line_handler.rb:36:in `handle'
    from /opt/homebrew/Cellar/fastlane/2.212.2/libexec/gems/fastlane-2.212.2/fastlane/lib/fastlane/commands_generator.rb:110:in `block (2 levels) in run'
    from /opt/homebrew/Cellar/fastlane/2.212.2/libexec/gems/commander-4.6.0/lib/commander/command.rb:187:in `call'
    from /opt/homebrew/Cellar/fastlane/2.212.2/libexec/gems/commander-4.6.0/lib/commander/command.rb:157:in `run'
    from /opt/homebrew/Cellar/fastlane/2.212.2/libexec/gems/commander-4.6.0/lib/commander/runner.rb:444:in `run_active_command'
    from /opt/homebrew/Cellar/fastlane/2.212.2/libexec/gems/fastlane-2.212.2/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb:124:in `run!'
    from /opt/homebrew/Cellar/fastlane/2.212.2/libexec/gems/commander-4.6.0/lib/commander/delegates.rb:18:in `run!'
    from /opt/homebrew/Cellar/fastlane/2.212.2/libexec/gems/fastlane-2.212.2/fastlane/lib/fastlane/commands_generator.rb:354:in `run'
    from /opt/homebrew/Cellar/fastlane/2.212.2/libexec/gems/fastlane-2.212.2/fastlane/lib/fastlane/commands_generator.rb:43:in `start'
    from /opt/homebrew/Cellar/fastlane/2.212.2/libexec/gems/fastlane-2.212.2/fastlane/lib/fastlane/cli_tools_distributor.rb:123:in `take_off'
    from /opt/homebrew/Cellar/fastlane/2.212.2/libexec/gems/fastlane-2.212.2/bin/fastlane:23:in `<top (required)>'
    from /opt/homebrew/Cellar/fastlane/2.212.2/libexec/bin/fastlane:25:in `load'
    from /opt/homebrew/Cellar/fastlane/2.212.2/libexec/bin/fastlane:25:in `<main>'

解决方法

1. 跳过价格档位同步

在upload_to_app_store动作中添加skip_price_tier: true参数,直接跳过价格相关元数据上传,规避空指针错误:

upload_to_app_store(
  skip_price_tier: true,
  # 保留原有其他参数
)

2. 确认App Store Connect价格配置

登录App Store Connect,进入目标应用的【定价与可用性】页面,确保已正确配置至少一个价格档位(免费应用需确认免费档位已设置)。配置完成后重新执行fastlane任务。

3. 检查本地元数据配置

如果项目使用了deliver的本地元数据目录(如metadata/),检查price_tier.json文件是否为空或格式错误。若无需自定义价格配置,可直接删除该文件,让fastlane复用App Store Connect上的配置。

4. 降级Fastlane版本

若上述方法无效,可能是2.212.2版本的deliver组件存在bug,可尝试降级至稳定版本:

brew install fastlane@2.211.0

切换版本后重新执行上传任务。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.23 05:48:13