firebase - 无法在 ios 中接收通知:发送 FcmTokenRefreshed 且未注册监听器
问题描述
我使用 fire-base 发送通知,在 ios 应用程序中我有这个错误:发送 FcmTokenRefreshed,如果应用程序打开接收通知但没有注册监听器,但当应用程序关闭时不接收并显示错误。
对不起我的英语不好!
“反应”:“16.4.1”
“反应原生”:“0.55.4”
"react-native-fcm": "^16.2.4",
“xcode 10.1”
解决方案
确保将这些行放在您的
文件:AppDelegate.m:
1)
import "RNFirebaseNotifications.h"
import "RNFirebaseMessaging.h"
2 ) 将此行添加到 didFinishLaunchingWithOptions [RNFirebaseNotifications 配置];
3)添加方法
(void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
[[RNFirebaseNotifications instance] didReceiveLocalNotification:notification];
}
(void)application:(UIApplication *)application didReceiveRemoteNotification:(nonnull NSDictionary *)userInfo
fetchCompletionHandler:(nonnull void (^)(UIBackgroundFetchResult))completionHandler{
[[RNFirebaseNotifications instance] didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];
}
(void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings {
[[RNFirebaseMessaging instance] didRegisterUserNotificationSettings:notificationSettings];
}
推荐阅读
- php - SQLSTATE [42S22]:未找到列:1054 'where 子句'中的未知列'answers.question_id'
- vue.js - Vue 应用程序中的 FullCalendar 4.0
- tableau-api - 如何链接下拉菜单选项以在 Tableau 中显示本地 HTML 文件?
- angular - 为 Angular Component Generation (ng gc) 预配置默认文件夹并在 ng 命令中省略文件夹名称
- android - 如何让应用程序在后台运行以执行下面提到的一些任务?
- dart - 如何处理紧密的无限流?
- multithreading - 代码中的两个连接语句有什么区别?
- powershell - 根据输入参数集更改 powershell cmdlet 的输出对象的属性
- javascript - 单击提交按钮后如何获取成功消息
- c# - 在 WPF 的 TreeView 中,有没有办法获取所选子节点的索引和所选子项的父节点的索引