将 firebase 与 SQLCipher 一起使用

Use firebase with SQLCipher

我有一个使用 SQLCipher 来读取和写入加密数据库的应用程序。

想使用 Firebase,我偶然发现了 2 个问题:

首先,一些……东西添加了 -l"sqlite3" 到我的 Pods/Target Support Files/Pods-ProjectName/Pods-ProjectName.debug.xcconfig(还有 release,ofc)。因此,我的应用程序 SQL 失败并出现错误 file is encrypted or is not a database

我通过在我的 Podfile 中添加一个 post_install 来解决这个问题,该 post_install 从所有配置文件中删除它们。

执行此操作后,Firebase SQL 开始失败并出现错误 no such table: s2dRmqIds

AFAIK,无法在同一个项目中使用 SQLite 和 SQLCipher,因为它们是互补的。

知道 Firebase 试图在 table 中保存什么吗?或者问题有多大?或者我是否可以更改存储机制?或者它是否是一个(已知)错误?

遇到了同样的问题,几个小时后,找到了[解决方案]!

  • 转到项目构建设置
  • 搜索其他链接器标志
  • 添加行-framework SQLCipher

就是这样!)

现在 Firebase 和 SQLCipher 将幸福地生活在一起。

我创建了一个 post 安装脚本,它从 firebase pods 中删除了 -l"sqlite3" 其他链接器标志,这很有帮助!

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      xcconfig_path = config.base_configuration_reference.real_path
      xcconfig = File.read(xcconfig_path)
      new_xcconfig = xcconfig.gsub('-l"sqlite3"', '')
      File.open(xcconfig_path, "w") { |file| file << new_xcconfig }
    end
  end
end