【问题标题】:Use firebase with SQLCipher将 firebase 与 SQLCipher 一起使用
【发布时间】:2016-11-10 14:06:30
【问题描述】:

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

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

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

我通过将post_install 添加到我的Podfile 来解决这个问题,从所有配置文件中删除这些。

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

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

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

【问题讨论】:

    标签: sqlite firebase sqlcipher


    【解决方案1】:

    我创建了一个安装后脚本,用于从 firebase pod 中删除 -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
    

    【讨论】:

      【解决方案2】:

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

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

      就是这样!)

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

      【讨论】:

      • 好吧,我的解决方案是停止使用 Firebase,但我相信你这行得通,所以我会接受它。
      • 这显示了其他已安装 pod 的构建设置错误 post pod install。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-12-23
      • 2016-09-16
      • 1970-01-01
      • 1970-01-01
      • 2012-05-11
      相关资源
      最近更新 更多