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

Flutter集成url_launcher遇Xcode报错:Module 'url_launcher_ios'未找到

解决Xcode报错“Module 'url_launcher_ios' not found”的方案
  • 彻底清理iOS依赖并重新安装

    1. 执行flutter clean清除Flutter缓存
    2. 进入iOS目录:cd ios
    3. 删除Pods文件夹和Podfile.lock:rm -rf Pods Podfile.lock
    4. 返回项目根目录执行flutter pub get
    5. 再次进入iOS目录执行pod install --repo-update(强制更新pod仓库后重新安装依赖)
  • 调整Podfile配置
    打开iOS目录下的Podfile,添加或修改以下配置:

    post_install do |installer|
      installer.pods_project.targets.each do |target|
        flutter_additional_ios_build_settings(target)
        # 为url_launcher_ios启用模块化头文件
        target.build_configurations.each do |config|
          if target.name == 'url_launcher_ios'
            config.build_settings['DEFINES_MODULE'] = 'YES'
          end
        end
      end
    end
    

    保存后重新执行pod install

  • 清除Xcode衍生数据并重启

    1. 完全关闭Xcode
    2. 删除Xcode衍生数据:rm -rf ~/Library/Developer/Xcode/DerivedData
    3. 重新打开项目并尝试编译
  • 检查url_launcher版本兼容性
    打开pubspec.yaml,指定与Flutter 3.3.10兼容的url_launcher版本,例如:

    dependencies:
      url_launcher: ^6.1.10
    

    执行flutter pub get后重新编译项目

  • 重新生成iOS项目文件(谨慎操作,建议先备份Info.plist等自定义配置)
    执行flutter create . --platforms ios,覆盖生成iOS基础配置文件,之后重新执行依赖安装步骤

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.04 23:00:16