Flutter iOS打包IPA遇SQLCipher.bundle多命令冲突问题求助
解决sqflite_sqlcipher打包IPA时SQLCipher.bundle冲突问题
以下是针对你遇到的FMDB-SQLCipher与SQLCipher-SQLCipher生成同名bundle冲突的可行解决方案:
方案1:通过Podfile钩子移除重复资源
在项目的ios/Podfile末尾添加post_install脚本,自动清理其中一个目标的冲突bundle资源:
post_install do |installer| installer.pods_project.targets.each do |target| if target.name == 'FMDB-SQLCipher' target.resources_build_phase.files.each do |file| target.resources_build_phase.remove_file(file) if file.file_ref.name == 'SQLCipher.bundle' end end end end
执行cd ios && pod install,之后重新尝试打包。
方案2:强制统一依赖版本
在ios/Podfile中直接指定SQLCipher和FMDB的版本,避免依赖链中出现重复引入:
pod 'SQLCipher', '~> 4.5.5' pod 'FMDB/SQLCipher', '~> 2.7.5'
执行cd ios && pod install --repo-update,确保依赖版本一致后再打包。
方案3:手动修改Xcode项目配置
- 打开
ios/Runner.xcworkspace - 找到Pods项目下的
FMDB-SQLCipher和SQLCipher-SQLCipher两个Target - 分别进入
Build Phases->Copy Bundle Resources - 删除其中一个Target下的
SQLCipher.bundle条目(推荐删除FMDB-SQLCipher下的) - 执行Xcode的清理操作(Cmd+Shift+K),重新打包
方案4:升级依赖到最新版本
尝试升级sqflite_sqlcipher到最新版,官方可能已修复该冲突:
flutter pub upgrade sqflite_sqlcipher
之后依次执行flutter clean、cd ios && pod deintegrate、pod install,再尝试打包。
内容的提问来源于stack exchange,提问作者varin sarkawt
相关产品推荐
相关产品推荐

