firebase - Xamarin Firebase Cloud 消息间歇性不起作用
问题描述
我正在使用Xamarin.Firebase.iOS.CloudMessaging v3.1.2 (nuget) 并且间歇性地我没有在 iPhone 上收到任何通知消息。
在我最新的测试中,从 Firebase 控制台发送消息:
- 消息 1:在iPhone和 Android上收到
- 消息 2(1 的重复):仅在 Android 上收到
- 消息 3(1 的重复):仅在 Android 上收到
- 消息 4(1 的重复):仅在 Android 上收到
- 消息 5(新消息):仅在 Android 上收到
由于这间歇性地工作,我认为实施应该没问题?有谁知道可以解释这种行为的任何问题?
private void RegisterForPushNotifications() {
// Register your app for remote notifications.
if (UIDevice.CurrentDevice.CheckSystemVersion(10, 0)) {
// iOS 10 or later
var authOptions = UNAuthorizationOptions.Alert | UNAuthorizationOptions.Badge | UNAuthorizationOptions.Sound;
UNUserNotificationCenter.Current.RequestAuthorization(authOptions, (granted, error) => {
//Console.WriteLine(granted);
});
// For iOS 10 display notification (sent via APNS)
UNUserNotificationCenter.Current.Delegate = this;
// For iOS 10 data message (sent via FCM)
Messaging.SharedInstance.Delegate = this;
}
else {
// iOS 9 or before
var allNotificationTypes = UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound;
var settings = UIUserNotificationSettings.GetSettingsForTypes(allNotificationTypes, null);
UIApplication.SharedApplication.RegisterUserNotificationSettings(settings);
}
UIApplication.SharedApplication.RegisterForRemoteNotifications();
}
如果有人可以帮助我对此有所了解,将不胜感激!
解决方案
这似乎是 Xamarin.iOS.CloudMessaging 中的一个错误;当降级 3.1.2 -> 2.0.8 时,一切又开始工作了。
我已经向 github 存储库发布了一个问题。
推荐阅读
- apache-spark-sql - Spark 单机版 v 2.3.2 测试失败
- django - 如何在 django oscar 中打印产品的零售价和成本价?
- vba - VBA多选项对话框输出
- excel - 使用 SPLIT 函数将数字列表与用户表单分开
- list - 如何通过引用将列表传递给 Cmake 函数
- javascript - 如何将我的 jwt 设置为 cookie 以防止在刷新时登录?
- apache-spark - Elasticsearch Spark,如何多次查询?
- sql - SQL to JSON - 将结果分组到 JSON 数组中
- java - 同步块和while循环优化排序
- python - 不同的 Scrapy 请求,相同的输出值