Encountered this issue when updating an app to the latest version of @nativescript/firebase-messaging-core (app had previously used @nativescript/firebase).
Sending the following notification to the app works on Android, but on iOS nothing happens when you tap it, the addOnMessage nor the addOnNotificationTap callbacks are triggered.
{
"aps": {
"alert": {
"title": "My title",
"body": "The body of the notification"
},
"badge": 9,
"sound": "sound"
},
"id": 123,
"url": "wp/v2/post"
}
However, adding "gcm.message_id" to it will trigger the callbacks:
{
"aps": {
"alert": {
"title": "My title",
"body": "The body of the notification"
},
"badge": 9,
"sound": "sound"
},
"id": 123,
"url": "wp/v2/post",
"gcm.message_id": "123"
}
In the userNotificationCenter(_:didReceive:withCompletionHandler:) function the registered callback is only fired if gcm.message_id is not null:
|
if (remoteNotification["gcm.message_id"] != nil) { |
|
var message = parseNotification(response.notification) |
|
message["foreground"] = UIApplication.shared.applicationState == UIApplication.State.active |
|
NSCFirebaseMessagingCore.onNotificationTapCallback?(message) |
|
} |
You shouldn't be required to add "gcm.message_id" to your notification call if you aren't using Firebase for iOS.
Encountered this issue when updating an app to the latest version of @nativescript/firebase-messaging-core (app had previously used @nativescript/firebase).
Sending the following notification to the app works on Android, but on iOS nothing happens when you tap it, the addOnMessage nor the addOnNotificationTap callbacks are triggered.
{ "aps": { "alert": { "title": "My title", "body": "The body of the notification" }, "badge": 9, "sound": "sound" }, "id": 123, "url": "wp/v2/post" }However, adding "gcm.message_id" to it will trigger the callbacks:
{ "aps": { "alert": { "title": "My title", "body": "The body of the notification" }, "badge": 9, "sound": "sound" }, "id": 123, "url": "wp/v2/post", "gcm.message_id": "123" }In the userNotificationCenter(_:didReceive:withCompletionHandler:) function the registered callback is only fired if gcm.message_id is not null:
firebase/packages/firebase-messaging-core/platforms/ios/src/NSCUNUserNotificationCenterDelegate.swift
Lines 53 to 57 in e286e88
You shouldn't be required to add "gcm.message_id" to your notification call if you aren't using Firebase for iOS.