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

iOS运行Flutter应用报错‘Expected identifier’,求解决方案

解决Flutter iOS构建时Xcode报"Expected identifier"错误的方案
  • 清理Xcode的DerivedData文件夹
    直接删除报错路径对应的DerivedData目录,也可通过Xcode操作:Xcode > Preferences > Locations > DerivedData,找到目标项目文件夹删除。或者执行命令:

    rm -rf /Users/mateusoliveira/Library/Developer/Xcode/DerivedData/Runner-gxfbahqkvmfgonavyldfixxczsxe
    
  • 清理Flutter缓存并重建项目
    在项目根目录依次执行:

    flutter clean
    flutter pub get
    cd ios
    pod deintegrate
    pod install
    cd ..
    flutter run
    
  • 检查版本配置合法性
    打开Xcode的Runner项目,查看Build Settings里的Version和Build号,确保无特殊字符或格式错误;同时检查Info.plist中的CFBundleShortVersionString和CFBundleVersion值是否符合规范。

  • 重新生成iOS项目文件(终极方案)
    先备份原ios目录,然后删除该文件夹,执行命令重新生成:

    flutter create --platforms ios .
    

    之后重新配置项目签名、第三方依赖等信息,再尝试构建。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.30 15:39:19