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

在iOS设备运行Flutter项目时遇Framework 'Reachability'未找到错误

问题:Flutter项目iOS模拟器编译报错(Reachability框架未找到)

错误信息

Error (Xcode): Framework 'Reachability' not found

Error (Xcode): Linker command failed with exit code 1 (use -v to see invocation)

Could not build the application for the simulator.
Error launching application on iPhone 16 Pro.

系统配置

  • Flutter SDK: 3.24.3
  • Xcode: 16.2
  • 设备:iPhone 16 Pro(模拟器)
  • MacBook: M3芯片(Apple Silicon)

已尝试的解决方法

  • 清理并重建:执行flutter clean和flutter pub get后重建项目,无效。
  • Pod安装:导航到iOS目录执行pod install,问题未解决。

可行解决方案

  • 检查并更新依赖插件:排查pubspec.yaml中依赖的插件,部分旧版网络状态插件(如connectivity)依赖废弃的Reachability框架,替换为维护中的替代插件(如connectivity_plus),更新后执行flutter pub get。
  • 重置Pod依赖:
    1. 进入iOS目录:cd ios
    2. 移除现有Pod集成:pod deintegrate
    3. 删除Pod锁文件:rm -rf Podfile.lock
    4. 重新安装Pod:pod install
    5. 清理Flutter缓存:flutter pub cache clean
  • 调整Podfile配置:在ios/Podfile中添加以下配置,解决Apple Silicon架构或框架链接问题:
    use_frameworks! :linkage => :static
    post_install do |installer|
      installer.pods_project.targets.each do |target|
        flutter_additional_ios_build_settings(target)
        target.build_configurations.each do |config|
          config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64'
        end
      end
    end
    
  • Xcode手动替换框架:打开ios/Runner.xcworkspace,进入项目Build Phases -> Link Binary With Libraries,移除找不到的Reachability框架,添加Apple官方的Network框架(替代Reachability实现网络状态检测)。
  • 调整Xcode架构设置:在Xcode的Build Settings -> Architectures中,设置为Standard Architectures,并在Excluded Architectures中为模拟器添加arm64,避免Apple Silicon模拟器的架构冲突。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.16 19:30:00