简体   繁体   中英

Please implement -messaging:didReceiveRegistrationToken: to be provided with an FCM token. FLUTTER - IOS

I am integrating Firebase Push notification in my Flutter project. Push notifications are working fine in Android but I am getting following error when trying to run IOS app:-

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

Following is my AppDelegate Code:- `

import UIKit
import Flutter
import UserNotifications
import Firebase

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate, MessagingDelegate {
    
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
    
        FirebaseApp.configure()
      Messaging.messaging().delegate = self

      GeneratedPluginRegistrant.register(with: self)

      if #available(iOS 10.0, *) {
    
          UNUserNotificationCenter.current().delegate = self
          let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound]
          UNUserNotificationCenter.current().requestAuthorization(
                  options: authOptions,
                  completionHandler: {_, _ in })
      } else {
          let settings: UIUserNotificationSettings =
          UIUserNotificationSettings(types: [.alert, .badge, .sound], categories: nil)
          application.registerUserNotificationSettings(settings)
      }
      application.registerForRemoteNotifications()

    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }

`

Trying to integrate Firebase Notification in FLutter App and expecting Push notification in IOS.

Basically, you need to implement didReceiveRegistrationToken so that the app will generate FCM token. You can check out this similar post .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM