繁体   English   中英

请实施 -messaging:didReceiveRegistrationToken: 以提供 FCM 令牌。 颤振 - IOS

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

我正在将 Firebase 推送通知集成到我的 Flutter 项目中。 推送通知在 Android 中运行良好,但在尝试运行 IOS 应用程序时出现以下错误:-

[FirebaseMessaging][I-FCM002023] 对象 <Runner.AppDelegate: 0x2837f4b10> 不响应 -messaging:didReceiveRegistrationToken:。 请实施 -messaging:didReceiveRegistrationToken: 以提供 FCM 令牌。

以下是我的 AppDelegate 代码:-`

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)
  }

`

尝试在 FLutter App 中集成 Firebase Notification,并期待在 IOS 中推送通知。

基本上,您需要实施didReceiveRegistrationToken以便应用程序生成 FCM 令牌。 你可以看看这个类似的帖子

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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