gpt4 book ai didi

swift - 如何调试 "The default Firebase app has not yet been configured."?

转载 作者:行者123 更新时间:2023-11-30 10:31:22 39 4
gpt4 key购买 nike

我似乎在调用 FirebaseApp.configure() 时收到错误消息“默认 Firebase 应用尚未配置”;这是我的代码:

  func configPushNotifications() {
NSLog("\(TAG) in configPushNotifications")
FirebaseApp.configure()
NSLog("\(TAG) called FirebaseApp.configure()")
Messaging.messaging().delegate = self
NSLog("\(TAG) set msg'ing delegate")
if #available(iOS 10.0, *) {
UNUserNotificationCenter.current().delegate = self
let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound]
UNUserNotificationCenter.current().requestAuthorization(
options: authOptions,
completionHandler: {_, _ in })
}
UIApplication.shared.registerForRemoteNotifications()
NSLog("\(TAG) called registerForRemoteNotifications")
}

...以及生成的日志:

2019-12-02 16:28:27.375255-0500 rMove[541:62736] _PH_ in configPushNotifications
2019-12-02 16:28:27.398807-0500 rMove[541:62982] 6.10.0 - [Firebase/Core][I-COR000003] The default Firebase app has not yet been configured. Add `[FIRApp configure];` (`FirebaseApp.configure()` in Swift) to your application initialization. Read more: [shortened URL here].
2019-12-02 16:28:27.403226-0500 rMove[541:62982] 6.10.0 - [Firebase/Core][I-COR000003] The default Firebase app has not yet been configured. Add `[FIRApp configure];` (`FirebaseApp.configure()` in Swift) to your application initialization. Read more: [shortened URL here].
2019-12-02 16:28:27.420648-0500 rMove[541:62982] 6.10.0 - [Firebase/Analytics][I-ACS024000] Debug mode is on
2019-12-02 16:28:27.469885-0500 rMove[541:62982] 6.10.0 - [Firebase/Analytics][I-ACS005000] The AdSupport Framework is not currently linked. Some features will not function properly. Learn more at [shortened URL here]
2019-12-02 16:28:27.472623-0500 rMove[541:62982] 6.10.0 - [GoogleUtilities/AppDelegateSwizzler][I-SWZ001008] Successfully created App Delegate Proxy automatically. To disable the proxy, set the flag GoogleUtilitiesAppDelegateProxyEnabled to NO (Boolean) in the Info.plist
2019-12-02 16:28:27.474543-0500 rMove[541:62982] 6.10.0 - [Firebase/Messaging][I-FCM002000] FIRMessaging library version 4.1.9
2019-12-02 16:28:27.475493-0500 rMove[541:62982] 6.10.0 - [GULReachability][I-REA902003] Monitoring the network status
2019-12-02 16:28:27.476105-0500 rMove[541:62982] 6.10.0 - [GULReachability][I-REA902003] Monitoring the network status
2019-12-02 16:28:27.476841-0500 rMove[541:62982] 6.10.0 - [Firebase/Messaging][I-FCM001000] FIRMessaging Remote Notifications proxy enabled, will swizzle remote notification receiver handlers. If you'd prefer to manually integrate Firebase Messaging, add "FirebaseAppDelegateProxyEnabled" to your Info.plist, and set it to NO. Follow the instructions at:
https://firebase.google.com/docs/cloud-messaging/ios/client#method_swizzling_in_firebase_messaging
to ensure proper integration.
2019-12-02 16:28:27.479696-0500 rMove[541:62736] _PH_ called FirebaseApp.configure()
2019-12-02 16:28:27.481380-0500 rMove[541:62736] _PH_ set msg'ing delegate
2019-12-02 16:28:27.526128-0500 rMove[541:63008] 6.10.0 - [Firebase/Analytics][I-ACS023007] Analytics v.60103000 started
2019-12-02 16:28:27.527311-0500 rMove[541:63008] 6.10.0 - [Firebase/Analytics][I-ACS023008] To disable debug logging set the following application argument: -noFIRAnalyticsDebugEnabled (see [shortened URL here])
2019-12-02 16:28:27.529499-0500 rMove[541:63008] 6.10.0 - [Firebase/Analytics][I-ACS023009] Debug logging enabled
2019-12-02 16:28:27.533081-0500 rMove[541:62736] _PH_ called registerForRemoteNotifications

这是我的应用程序的新版本,我没有从工作版本中修改此代码。如何调试这个问题?

最佳答案

使用 Xcode 的调试器,我发现位于 FirebaseApp.configure() 调用堆栈中的 Firebase Messaging 在 FirebaseApp.configure() 设置之前尝试访问默认的 Firebase 应用。在 *-Info.plist 中设置 FirebaseMessagingAutoInitEnabled 的值可以解决此问题;在默认应用程序之前检查了 plist 值。

关于swift - 如何调试 "The default Firebase app has not yet been configured."?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59147231/

39 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com