如何将Firebase cocoaPods集成到自定义的swift框架中? [英] How do I Integrate the Firebase cocoaPods in my custom swift framework?

查看:98
本文介绍了如何将Firebase cocoaPods集成到自定义的swift框架中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想构建一个iOS swift框架(例如XYZ),供用户使用自定义的访问令牌登录Firebase。
我完成了登录方法,并在XYZ中获得了访问令牌。现在,我想在XYZ中集成Firebase以将访问令牌传递给Firebase。
因此,我使用cocoaPods在XYZ中安装了Firebase。并编写代码并构建XYZ框架。一切似乎都很好。

I want to build a iOS swift framework (ex. XYZ) which for users to login firebase with customized access token. I finished my login method and get the access token in XYZ. Now I want to Integrate the Firebase in XYZ to pass the access token to Firebase. So I install Firebase in XYZ with cocoaPods. and write the code and build a XYZ framework. Everything seems fine.

比我创建一个快速的项目ABC,并导入XYZ框架。然后,在我导入XYZ的那一行中,出现错误缺少所需的模块'Firebase'。

Than I create a swift project ABC, and import XYZ framework. Then I got error "Missing required module 'Firebase' " at the line I import XYZ.

如果我还通过cocoaPods在ABC中安装了Firebase。它将成功运行,但会收到许多有关 ABC和XYZ中都实现了FirebaseXXX类的错误。将使用两者之一。未定义。很快就会崩溃。

If I also install Firebase in ABC with cocoaPods. It will run successfully but get many errors about "Class FirebaseXXX is implemented in both ABC and XYZ. One of the two will be used. Which one is undefined." And Crash soon.

请有人帮我弄清楚如何解决此问题?

Would Someone please help me to figure it out how to fix this problem?

推荐答案

您是否尝试过以下Podfile:

Have you tried a podfile like:

platform :ios, '9.0'

target 'ABC' do
  use_frameworks!
  workspace 'ABC'
  project 'ABC'

  pod 'Firebase'
  # ...
end

target 'XYZ' do
    use_frameworks!
    workspace 'ABC'
    project 'XYZ'

    # pods for the framework
    pod 'Firebase'
    # ...
end

这篇关于如何将Firebase cocoaPods集成到自定义的swift框架中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆