【问题标题】:iOS Swift Firebase SDK Import issueiOS Swift Firebase SDK 导入问题
【发布时间】:2017-06-30 09:10:21
【问题描述】:

我一直在尝试将 Firebase 导入我的项目。我在其他项目中做过几次,没有任何问题。当我在 AppDelegate 中导入 Firebase 并调用 FirebaseApp.configure() 时,一切都很好,没问题。

当我在项目的其他部分导入 Firebase/Database 时出现问题,突然在 AppDelegate 中出现错误,没有这样的模块 Firebase,我无法调用 FirebaseApp.configure()。

这也发生在其他导入的 firebase 模块上,例如远程配置。

这些是我要导入的 pod

pod 'Firebase/RemoteConfig'
pod 'Firebase/Database'

我找到的唯一解决方案是制作 Objective C 包装器,该包装器在实现文件中导入 Firebase 模块,这样就不会公开导入另一个 Firebase 模块。

【问题讨论】:

  • 显示 pod 更新的输出

标签: ios swift firebase firebase-realtime-database cocoapods


【解决方案1】:

use_frameworks 添加到您的 Podfile 中

示例

  platform :ios, "9.0"
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
    use_frameworks!

    target 'yourprojectTarget' do
     pod 'Firebase'
    end

那么

pod install --no-repo-update

【讨论】:

  • 我有use_frameworks!从一开始就在我的 podfile 中添加一行
  • 如果您使用过 use_frameworks 然后删除导入行,它将自动导入到您的 swift 项目中。
  • 不,它不会导入,同样我必须导入 Snapkit、FBSDK 等。否则框架不可见
猜你喜欢
  • 2020-03-20
  • 2018-10-23
  • 2016-11-21
  • 2020-04-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多