- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
您好,在我的应用程序中使用 FCM
。
当我尝试读取 FCM
token 时,即使编译器不调用此委托(delegate)方法,也请提供帮助。
当我放置中断并检查此方法时,不要使用 ios11 swift4 调用我
extension AppDelegate: MessagingDelegate{
func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String) {
print("Firebase registration token: \(fcmToken)")
let dataDict:[String: String] = ["token": fcmToken]
NotificationCenter.default.post(name: Notification.Name("FCMToken"), object: nil, userInfo: dataDict)
// TODO: If necessary send token to application server.
// Note: This callback is fired at each app startup and whenever a new token is generated.
}
func messaging(_ messaging: Messaging, didReceive remoteMessage: MessagingRemoteMessage) {
print("Message data:", remoteMessage.appData)
}
}
最佳答案
didReceiveRegistrationToken
是一个委托(delegate)函数。它将在收到 Firebase 的 token 后被调用。如果没有被调用,请确保您已遵循 AppDelegate 中的代码
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
FirebaseApp.configure()
Messaging.messaging().delegate = self
return true
}
通过 Messaging.messaging().delegate = self
,我们注册 AppDelegate
以接收来自 Firebase 的方法调用
关于ios - FCM token 不调用 didReceiveRegistrationToken,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56968730/
我正在使用 firebase 构建一个应用程序,并尝试保存推送通知的 FCM token (由 firebase 函数发送)。 我尝试这样做的方式是将 deviceToken 存储在 UserDefa
您好,在我的应用程序中使用 FCM。 当我尝试读取 FCM token 时,即使编译器不调用此委托(delegate)方法,也请提供帮助。 当我放置中断并检查此方法时,不要使用 ios11 swift
我使用 ionic 4 和 FCM 来获取通知,一切在 Android 上运行良好,但在 iOS 上则不然。我在 xcode 控制台上遇到此消息 "5.7.0 - [Firebase/Messagin
当我尝试在 XCode 中编译我的应用程序时,我遇到了这种情况,在 android 中它运行完美,但在那里,它失败了,这是我直接从 Firebase 云使用的功能。 func messaging(_
我是一名优秀的程序员,十分优秀!