【问题标题】:Firebase configurationFirebase 配置
【发布时间】:2017-11-17 12:33:55
【问题描述】:

我正在开发一个 iOS 应用程序,我的 pod 文件看起来像

platform :ios, '8.0'  
use_frameworks!

target 'MYAPP' do  
    pod 'Google-Mobile-Ads-SDK'  
    pod 'Google/SignIn'  
    pod 'Alamofire', '~> 4.0'  
    pod 'AlamofireImage', '~> 3.1'  
end

target 'MYAPPTests' do  
    pod 'Google-Mobile-Ads-SDK'  
    pod 'Google/SignIn'  
    pod 'Alamofire', '~> 4.0'  
    pod 'AlamofireImage', '~> 3.1'  
end

target 'MYAPPUITests' do  
    pod 'Google-Mobile-Ads-SDK'  
    pod 'Google/SignIn'  
    pod 'Alamofire', '~> 4.0'  
    pod 'AlamofireImage', '~> 3.1'  
end

当我运行应用程序并在控制台中不断发现以下警告时:

[Firebase/Core][I-COR000003] 默认的 Firebase 应用还没有 已配置。将 [FIRApp 配置] 添加到您的应用程序 初始化。阅读更多:“。

所以在我的 appdelegate 中,我添加了 FIRApp.configure() 导致崩溃

' [Firebase/Messaging][I-IID001000] Firebase 未设置 正确。发件人 ID 为 nil 或为空。 2017-06-14 18:25:37.044 MYAPP[10520:128089] *** 由于未捕获的异常而终止应用程序 'com.firebase.instanceid',原因:'无法配置 Firebase 实例 ID。 Google Sender ID 不得为 nil 或为空。''

GoogleModbileAdsSDK 需要 Firebase 配置吗? 我在这里错过了什么?

【问题讨论】:

  • 你在使用 firebase 吗?你在 pod 中的 firebase 在哪里?
  • 实际上我并没有专门使用 Firebase。但我不断收到设置 Firebase 的警告。所以我怀疑它是由于我使用的其他一些 SDK 而出现的,可能是 Alamofire。对此有什么想法吗?
  • Alamofire 与 firebase 无关。

标签: ios swift firebase


【解决方案1】:

看看这个 https://firebase.google.com/docs/ios/setup 您需要将需要从数据库中使用的 pod 文件添加到 pod 文件中

【讨论】:

  • 我实际上不想使用 Firebase。那么为什么我的控制台会打印一条配置 Firebase 的警告呢?
  • 我在同一条船上...我实际上不想使用它...所以关闭 Firebase 的控制台转储会很棒。
【解决方案2】:

如果您不想安装其他 google 软件包,请使用

pod 'GoogleSignIn'

它只会安装 googleSignIn 所需的包

【讨论】:

    【解决方案3】:

    尝试在 AppDelegate.swift 中添加此代码

    override init() {
            FirebaseApp.configure()
    }
    

    而不是配置在:

     func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool
    

    【讨论】:

      猜你喜欢
      • 2018-09-29
      • 2018-03-15
      • 1970-01-01
      • 2022-07-10
      • 2020-05-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多