简体   繁体   English

如何在我的自定义swift框架中集成Firebase cocoaPod?

[英]How do I Integrate the Firebase cocoaPods in my custom swift framework?

I want to build a iOS swift framework (ex. XYZ) which for users to login firebase with customized access token. 我想构建一个iOS swift框架(例如XYZ),供用户使用自定义访问令牌登录firebase。 I finished my login method and get the access token in XYZ. 我完成了登录方法并在XYZ中获取了访问令牌。 Now I want to Integrate the Firebase in XYZ to pass the access token to Firebase. 现在,我想在XYZ中集成Firebase,将访问令牌传递给Firebase。 So I install Firebase in XYZ with cocoaPods. 所以我使用cocoaPods在XYZ中安装Firebase。 and write the code and build a XYZ framework. 并编写代码并构建XYZ框架。 Everything seems fine. 一切似乎都很好。

Than I create a swift project ABC, and import XYZ framework. 比我创建一个快速项目ABC,并导入XYZ框架。 Then I got error "Missing required module 'Firebase' " at the line I import XYZ. 然后我在导入XYZ的行中收到错误“Missing required module'Firebase'”。

If I also install Firebase in ABC with cocoaPods. 如果我还使用cocoaPods在ABC中安装Firebase。 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." 它将成功运行,但会收到很多关于“类FirebaseXXX在ABC和XYZ中实现的错误。将使用其中一个。未定义哪一个。” And Crash soon. 并很快崩溃。

Would Someone please help me to figure it out how to fix this problem? 有人请帮我弄明白如何解决这个问题吗?

Have you tried a podfile like: 你有没有试过像这样的podfile:

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

?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM