Search code examples
iosfirebasecordovaapple-push-notificationscordova-plugins

How to connect ios cordova app to apple push notifications


I have a cordova app with cordova-plugin-firebasex. It works perfect on ios and android except one thing:

there are no system notifications on ios.

My app receive data messages from firebase, but I can't send a notification from firebase console to ios system notification center.

  1. I created Apple developer cert and install it on my Mac
  2. I created iOS distribution cert and install it on my Mac
  3. I created a new identifier with push notifications
  4. Created two certs for push notifications (dev & dist) and install it on my Mac
  5. Created profiles for dist and dev and install it on my Mac
  6. Created new cordova project and install cordova-plugin-firebasex. All Pod's installed succesfully.
  7. Open project in XCode and in Signing & Capabilities download and select my profiles for debug and release
  8. Push notifications is present in Signing & Capabilities.

Then I created one Big APNS Button in my app to show my apns token, created archive and upload it to TestFlight.

But when I install my app on my iPhone SE - I don't see a dialog about allow push notifications. And when I press my Big APNS Button - I see a null.

How can I solve this?


Solution

  • FIXED

    FirebasePlugin.grantPermission(function(hasPermission){
        console.log("Permission was " + (hasPermission ? "granted" : "denied"));
    });