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

Flutter iOS真机编译报错:Linker command failed with exit code 1

Flutter iOS真机编译链接错误解决方案(适配Xcode15.2 + macOS13.7.1)

以下是针对你遇到的链接器错误(Undefined symbols、Linker command failed with exit code 1)的具体解决步骤:

  • 清理全链路缓存并重新构建依赖

    • 执行Flutter清理命令:flutter clean
    • 删除iOS目录下的Pods缓存文件:rm -rf ios/Pods ios/Podfile.lock
    • 重新拉取Flutter依赖:flutter pub get
    • 进入iOS目录更新并安装Pods:cd ios && pod install --repo-update
    • 清理Xcode构建缓存:打开Xcode后按Cmd+Shift+K(或通过菜单Product > Clean Build Folder)
  • 检查并修正Xcode链接器配置

    • 打开iOS项目的Runner.xcworkspace,选中Runner Target
    • 切换到Build Settings标签,搜索Other Linker Flags,添加-ObjC参数(若未添加),移除无效或重复的参数
    • 搜索Dead Code Stripping,确保Debug和Release环境均设置为YES
  • 排查依赖插件兼容性

    • 执行flutter pub outdated查看插件版本状态,针对性升级或降级存在兼容性问题的插件(优先排查近期更新的插件)
    • 确认所有插件支持Xcode15及当前测试设备的iOS版本
  • 调整Xcode架构设置

    • 在Build Settings中搜索Architectures,设置为Standard Architectures (arm64)
    • 搜索Excluded Architectures,确保各环境下未排除arm64架构
  • 重置iOS项目配置(若以上步骤无效)

    • 备份iOS目录下的签名配置、Info.plist等自定义文件
    • 删除Runner.xcworkspace和Runner.xcodeproj文件
    • 执行flutter create --platforms ios .重新生成iOS项目文件,再恢复自定义配置后重新构建

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.16 08:54:56