Я внедряю push-уведомления FCM, используя FirebasePushNotificationPlugin
in Xamarin.Forms
. В проекте iOS в AppDelegate
при генерации RegisteredForRemoteNotifications
вызова метода deviceToken
генерация, но когда я отправляю почтальону уведомление для сгенерированного token
, я получаю ошибку.
{"multicast_id": 8631208504861228784, "success": 0, "fail": 1,
"canonical_ids": 0, "results": [{"error": "InvalidRegistration"}]
}
Это код, который у меня есть на AppDelegate
полученный от здесь :
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
global::Xamarin.Forms.Forms.Init();
LoadApplication(new App());
FirebasePushNotificationManager.Initialize(options, new NotificationUserCategory[]
{
new NotificationUserCategory("message",new List<NotificationUserAction> {
new NotificationUserAction("Reply","Reply",NotificationActionType.Foreground)
}),
new NotificationUserCategory("request",new List<NotificationUserAction> {
new NotificationUserAction("Accept","Accept"),
new NotificationUserAction("Reject","Reject",NotificationActionType.Destructive)
})
});
return base.FinishedLaunching(app, options);
}
public override void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken)
{
FirebasePushNotificationManager.DidRegisterRemoteNotifications(deviceToken);
Console.WriteLine("Token- - - : "+deviceToken);
}
public override void FailedToRegisterForRemoteNotifications(UIApplication application, NSError error)
{
FirebasePushNotificationManager.RemoteNotificationRegistrationFailed(error);
}
public override void DidReceiveRemoteNotification(UIApplication application, NSDictionary userInfo, Action<UIBackgroundFetchResult> completionHandler)
{
FirebasePushNotificationManager.DidReceiveMessage(userInfo);
System.Console.WriteLine(userInfo);
completionHandler(UIBackgroundFetchResult.NewData);
}
данные object
в почтальоне при отправке образца уведомления
{
"to":"79f64b43339859a329a935f7a3e417ecc1599fbb5d6935afbooa3b4291c07fa7",
"notification" : {
"body" : "New task",
"content_available" : true,
"priority" : "high",
"color":"Page1",
"title":"Announcement"
},
"data" : {
"color":"Page1",
"title":"title",
"content_available" : true,
"body" : "New Announcement ad"
}
}
Тело почтальона
Это настройка профилей обеспечения из Visual Studio
Как я могу решить эту проблему?