Ad

Cordova Firebase Plugin: Apple Push Notifications Do Not Work Sometimes When Installing A New App

I'm building a new version of a Cordova project that uses the push notifications for the first time. I use the 'cordova-plugin-firebase' version 1.0.5 for handling them. Everything works fine on Android, but on iOS I seem to have a problem. If I download the official app from AppStore and then upgrade it with the new version via XCode, the push notifications doesn't seem to work (no "message" appears at the top in iOS). If I have the app opened, the XCode debugger prints the push notification and it looks like this:

{
  "collapse_key" = "bundle_ID";
  from = FIREBASE_ID;
  notification = {
    body = "This is a message";
    title = "Message";
  };
  tap = 0;
}

If I then close the XCode project and create a new one (or open this newly created one again) with all source copied to it and the cordova plugins installed into and then build and install it via XCode, the push notifications start working again and the push notification in the XCode debugger looks like this:

{
  aps = {
    alert =         {
        body = "This is a message";
        title = "Message";
    };
  };
  tap = 0;
}

Should push notification formats differ? Has anyone experienced some similar behavior and how did you solve it?

Ad

Answer

It seems there was a bug or something in the iOS project. When I removed the ios platform and newly installed it everything started working and it still works until this day.

Also Apple's APS has different push notification object structure than Android's FCM.

Ad
source: stackoverflow.com
Ad