在IOS模拟器中运行我的应用程序时,出现此错误: 有人知道为什么吗?
顺便说一句,它适用于Android。
这里有一些示例代码:
AppDelegate.swift
import UIKit
import Flutter
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
if #available(iOS 10.0, *) {
UNUserNotificationCenter.current().delegate = self as? UNUserNotificationCenterDelegate
}
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
获取令牌的方法
_firebaseMessaging.getToken().then((token) {
print("Firebase Messaging Token: $token\n");
usersRef.document(firebaseUser.uid).updateData({"FCMToken": token});
});