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

Flutter集成firebase_core插件后执行Podfile post-install hook时出现`continue`未定义错误的技术求助

解决Flutter安装firebase_core后Podfile post-install钩子错误

这个问题的核心是Ruby语法使用错误:你在Podfile的post-install回调代码里用了continue关键字,但Ruby中在迭代块(比如each循环)里跳过当前循环的正确写法是next,continue是Java、C++这类语言的语法,Ruby并不识别它,所以才会抛出undefined local variable or method 'continue'的错误。

具体修复步骤:

  1. 打开你的Flutter项目中的ios/Podfile文件
  2. 找到报错的那行代码:
    continue if xcframework_file.start_with?(".") # Hidden file, possibly on external disk
    
  3. 将continue替换为Ruby的next:
    next if xcframework_file.start_with?(".") # Hidden file, possibly on external disk
    
  4. 保存Podfile后,在iOS目录下执行:
    pod install
    
    或者回到Flutter项目根目录执行:
    flutter pub get
    
  5. 重新运行你的Flutter应用,这个错误应该就会消失了

额外说明:

你之前尝试的重装CocoaPods、Ruby版本切换、flutter clean等操作,其实都没有触及问题的本质——因为错误是来自你自定义的Podfile代码语法,而不是CocoaPods或Ruby环境本身。只要修正这个语法错误,问题就能解决。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.04.28 23:58:10