iOS Swift Firebase SDK 导入问题

标签 ios swift firebase firebase-realtime-database cocoapods

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

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

导入的其他 Firebase 模块也会发生这种情况,例如远程配置。

这些是我要导入的 Pod

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

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

最佳答案

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

关于iOS Swift Firebase SDK 导入问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44842764/

相关文章:

arrays - 从 SKSpriteNode 类实例访问 GameScene 中的数组?

ios - 快速在 UICollectionViewCell 中的 UIimage 上设置圆角

iOS AFNetworking 当互联网连接恢复时自动重试请求

ios - 是否可以在 iOS 中使用安全框架生成证书签名请求 (.csr)?

当后台服务调用我的应用程序挂起时的 IOS

ios - firebase auth/swift - 匿名用户不会在 applicationWillTerminate 上删除?

ios - 无法在欧洲访问 Firebase 数据库,而在亚洲可以在 iOS 应用程序中访问

android - 将图像从 android 上传到 Firebase 后如何获取图像 URL?

firebase - 如何在 flutter 中从 firebase 数据构建 Map<DateTime, List>

iphone - 如何使用 Xcode 4.2 测试设备上的发布版本?