【问题标题】:How to wisely use FirebaseFirestoreSwift with Carthage?如何明智地将 FirebaseFirestoreSwift 与 Carthage 结合使用?
【发布时间】:2020-04-22 19:02:34
【问题描述】:

我正在寻找FirebaseFirestoreSwift 和迦太基共存的方式。

我正在使用 FirebaseFirestoreFirebaseFirestoreSwift 以及其他 Firebase 框架。 通常使用 Cocoapods,但是构建很重,需要很长时间。

所以我尝试使用 Carthage。

幸运的是我找到了公共迦太基github。 通过这个,我能够转换为使用 Firebase 框架到 carthage。 但是没有FirebaseFirestoreSwiftBinary

我只为FirebaseFirestoreSwift 使用了Cocoapods,因为它无济于事。 但它甚至下载并构建了相关的FirebaseFirestore,抹去了 Carthage 的好处。

然后我尝试下载 podspec 并使用未设置依赖项的本地 podspec,如下所示: FirebaseFirestoreSwift。我删除了第 39 行。

但是这种方式是失败的。未能建立。 因为 FirebaseFirestoreSwift 有import FirebaseFirestore

我想使用$ {SRCROOT} /Carthage/Build/iOS/FirebaseFirestore.framework,但想不出一个好方法。

有没有人有好的想法或成功的方法?

【问题讨论】:

    标签: ios swift firebase google-cloud-firestore cocoapods


    【解决方案1】:

    构建二进制文件的步骤如下:

    [
      {
        "name": "FirebaseFirestoreSwift"
      }
    ]
    
    • 接下来我们需要运行ZipBuilder 工具来构建二进制文件。 Docs for ZipBuilder..
    • 以下命令swift run zip-builder --zip-pods $(pwd)/pods.json 将为各种不同的架构构建FirebaseFirestore.swift。有关如何使用 ZipBuilder 的更多信息,请使用swift run zip-builder --help

    【讨论】:

      【解决方案2】:

      cocoapods-binary 插件是一种通过缓存预构建框架来加速构建的方法。详情见https://github.com/FirebaseExtended/flutterfire/issues/349#issuecomment-562318371

      【讨论】:

        【解决方案3】:

        您可以使用 Firebase 的 ZipBuilder 工具来创建二进制文件。本质上,您需要为所需的 pod 创建 .xcframework,然后将它们直接导入您的项目或创建托管二进制文件的 Carthage 存储库。

        您需要创建一个 JSON 文件,告诉 ZipBuilder 您要创建哪些 pod:

        //Pods.json
        [
          {
            "name": "FirebaseFirestoreSwift"
          }
        ]
        

        然后运行 ​​ZipBuilder:

        swift run ReleasePackager -templateDir $(pwd)/Template -zipPods Pods.json

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2014-03-05
          • 1970-01-01
          • 2015-05-27
          • 2018-08-27
          • 2011-07-16
          • 1970-01-01
          • 1970-01-01
          • 2020-11-06
          相关资源
          最近更新 更多