I send this to Firebase:
{
"to" : "/topics/12344",
"priority" : "high",
"data" : {
"c" : "sometext",
"t" : "someothertext"
},
}
On Android I can create custom notification using the "data" payload with accessing its objects. I don't have to send the message title and body because I create custom text. This works even if the app is closed.
On iOS I can access the custom data using:
func messaging(_ messaging: Messaging, didReceive remoteMessage: MessagingRemoteMessage) {
print("Received data message: \(remoteMessage.appData)")
}
But it only prints if the the app is opened, not when closed. If I send the "notification array" to Firebase, it creates a notification when the app is closed, but I am not able to access the custom payload.
My question: How can I access the custom payload on iOS when the app is closed and create a notification?