Flutter运行iPhone设备报错:No such module 'CioInternalCommon'
解决思路
1. 彻底清理缓存并重新拉取依赖
执行以下命令清除Flutter和Pub的缓存,确保依赖包完整下载:
flutter clean flutter pub cache clean flutter pub get
2. 升级customer_io插件版本
当前使用的customer_io-1.3.1可能与Xcode 15.2存在兼容性问题。修改项目pubspec.yaml中的依赖,升级到该插件的最新稳定版:
dependencies: customer_io: ^最新稳定版本号
执行flutter pub get更新依赖后,重新尝试构建项目。
3. 在Podfile中统一Swift版本
Xcode 15对Swift版本要求更严格,在项目的ios/Podfile中添加以下配置,强制指定适配Xcode 15的Swift版本(如5.9):
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['SWIFT_VERSION'] = '5.9' end end end
修改完成后,进入ios目录重新安装Pods:
cd ios && pod install
4. 直接通过Xcode构建排查问题
跳过flutter run,直接打开项目的ios/Runner.xcworkspace文件,在Xcode中操作:
- 检查Build Phases -> Link Binary With Libraries中是否包含
CioInternalCommon框架,若缺失则重新拉取Pods后再次确认。 - 统一设置Build Settings -> Swift Language Version为支持的版本(如5.9)。
5. 修复损坏的插件缓存
如果插件缓存文件损坏,手动删除customer_io-1.3.1目录后重新拉取:
rm -rf /Users/pasquale.delucia/.pub-cache/hosted/pub.dev/customer_io-1.3.1 flutter pub get
6. 调整Flutter版本适配Xcode(备选)
若上述方法无效,尝试切换到适配Xcode 15的Flutter稳定版(如3.19.x),或降级到兼容的旧版本:
flutter channel stable flutter upgrade 3.19.0 # 或执行 flutter downgrade 3.13.9 降级版本
内容的提问来源于stack exchange,提问作者Pasquale De Lucia
相关产品推荐
相关产品推荐

