I have connected my IONIC 4 app to Firebase and then to AWS SNS. Everything works perfectly for Android, the push notifications are delivered. But iOS devices never receives them. I have made all the necessary configs, certificates and keys. When I publish a test message via Firebase Console, the iOS devices receive the notifications.
I get a little confuse about this payload object and I guess it might be causing this issue.
The payload object (ignore the values):
var payload = {
default: "TrokaĆ",
GCM: {
data: { message: "A", payload: "", title: "C" },
notification: {
message: "E",
payload: "F",
title: "TrokaĆ",
body: msgPush
}
},
APNS: {
aps: {
alert: {
title: "Game Request",
body: "Bob wants to play poker",
"action-loc-key": "PLAY"
},
badge: 5
},
acme1: "bar",
acme2: ["bang", "whiz"]
}
};
payload.GCM = JSON.stringify(payload.GCM);
payload.APNS = JSON.stringify(payload.APNS);
payload = JSON.stringify(payload);
The publishing method:
sns.publish(
{
Message: payload,
MessageStructure: "json",
TargetArn: device.endpoint
},
function(err, data) {
if (err) {
return;
}
}