capacitor-firebase: bug: Firebase Messaging not initialized

Plugin(s):

Platform(s):

  • ios

Current behavior: I added the plugin to my capacitor app, set up push notifications and background modes. Added snippets as described to AppDelegate.swift and FirebaseAppDelegateProxyEnabled to Info.plist. Also added GoogleService-Info.plist to the xcode project.

After building and running the app on a mobile device, I see these errors in xcode logs:

[FirebaseCore][I-COR000003] The default Firebase app has not yet been configured. Add `FirebaseApp.configure()` to your application initialization. This can be done in in the App Delegate's application(_:didFinishLaunchingWithOptions:)` (or the `@main` struct's initializer in SwiftUI).

[FirebaseMessaging][I-FCM002023] The object <CapacitorFirebaseMessaging.FirebaseMessaging: 0x282da5380> does not respond to -messaging:didReceiveRegistrationToken:. Please implement -messaging:didReceiveRegistrationToken: to be provided with an FCM token.

Expected behavior: No warnings of uninitialized Firebase components in xcode log.

Steps to reproduce: build and run the app.

Related code:

Other information:

Capacitor doctor:

💊   Capacitor Doctor  💊 

Latest Dependencies:

  @capacitor/cli: 3.6.0
  @capacitor/core: 3.6.0
  @capacitor/android: 3.6.0
  @capacitor/ios: 3.6.0

Installed Dependencies:

  @capacitor/cli: 3.5.1
  @capacitor/core: 3.6.0
  @capacitor/android: 3.6.0
  @capacitor/ios: 3.6.0

[success] iOS looking great! 👌
[success] Android looking great! 👌

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (8 by maintainers)

Most upvoted comments

Now I am messing around with the code locally, but no luck so far. I even put it in the launch method as suggested from you and the firebase docs:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.
        if FirebaseApp.app() == nil {
            FirebaseApp.configure()
        }
        
        return true
    }

And I still get this warning. So something is wrong with my local test app. I will dig a little deeper.

Ok, I will prepare a testrepo. For Android it works as expected, only iOS is affected.