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

升级Xcode14后Flutter编译报错:Cannot find 'webviewController' in scope

解决Xcode14升级后Flutter项目因html_editor_enhanced依赖导致的编译错误

升级Xcode至14.0后,Flutter项目因html_editor_enhanced包依赖的旧版flutter_inappwebview(5.4.3+7)出现iOS端Swift编译错误,提示Cannot find 'webviewController' in scope,移除该包可正常编译,但需要保留WYSIWYG编辑器功能。

解决步骤

1. 强制升级flutter_inappwebview到兼容Xcode14的版本

旧版flutter_inappwebview 5.4.3+7未适配Xcode14的Swift语法,需要强制升级到更高版本(推荐6.x及以上稳定版)。在项目的pubspec.yaml中添加依赖覆盖:

dependency_overrides:
  flutter_inappwebview: ^6.0.0 # 可替换为最新稳定版

执行命令更新依赖:

flutter pub get

2. 清理缓存与重建依赖

  • 清理Flutter项目缓存:
flutter clean
  • 进入iOS目录,删除旧的Pod锁文件并重新安装依赖:
cd ios
rm Podfile.lock
pod install
  • 若仍有问题,手动删除pub缓存中的旧版本包:
rm -rf ~/development/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.4.3+7

3. 检查Xcode项目配置

  • 打开iOS项目的Runner.xcworkspace,进入Build Settings -> Swift Language Version,确保设置为Swift 5;
  • 确认项目的Deployment Target不低于iOS 11.0(flutter_inappwebview 6.x最低要求iOS 11)。

4. 适配html_editor_enhanced兼容性

如果升级flutter_inappwebview后出现与html_editor_enhanced的兼容性问题,尝试将html_editor_enhanced升级到最新版本,新版本通常会适配依赖包的更新。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.19 04:45:41