cordova-plugin-fcm-with-dependecy-updated icon indicating copy to clipboard operation
cordova-plugin-fcm-with-dependecy-updated copied to clipboard

Not able to receive notification on iOS 12+

Open imajayverma opened this issue 4 years ago • 7 comments
trafficstars

The plugin is working fine in android , but on iOS it's not working. I'm using plugin version 7.4.0, also tried 7.5.0 on both ionic 3 and ionic 5. Other latest version of plugin even 7.8.0 is giving build error. Please help

Ionic: Ionic CLI : 5.4.6 Ionic Framework : ionic-angular 3.9.2 @ionic/app-scripts : 3.2.4

Cordova: Cordova CLI : 10.0.0 Cordova Platforms : ios 6.1.1 NodeJS : v10.17.0 npm : 6.11.3 OS : macOS Catalina Xcode : Xcode 12.0.1 Build version 12A7300

@andrehtissot

imajayverma avatar Jul 29 '21 11:07 imajayverma

I have also the same issue

Ibni-Amin avatar Jul 30 '21 04:07 Ibni-Amin

Were either of you able to figure out the cause? We have been looking at this for a month can can't figure it out. Android works great but IOS does not receive notificaiton.

mstockbridge2000 avatar Aug 14 '21 21:08 mstockbridge2000

On iOS the following code should be called in the very beginning:

        // Needed for iOS
        if (typeof(window.cordova.platformId) == "undefined" || window.cordova.platformId != 'android') {
            // Asks only once
            FCM.requestPushPermission()
                .then(function (didIt) {
                    if (didIt) {
                        // Do nothing
                    }
                })
                .catch(function (error) {
                    alert('Error occurred: '+error)
                });
        }

freescout-helpdesk avatar Aug 24 '21 08:08 freescout-helpdesk

I'm having the same error, could someone help me? I'm using ionic 4

DrDaxter avatar Aug 26 '21 21:08 DrDaxter

For Ionic 5, please make sure that import to the correct file:

import { FCM } from "cordova-plugin-fcm-with-dependecy-updated/ionic";

metadevj avatar Sep 13 '21 06:09 metadevj

On iOS the following code should be called in the very beginning:

        // Needed for iOS
        if (typeof(window.cordova.platformId) == "undefined" || window.cordova.platformId != 'android') {
            // Asks only once
            FCM.requestPushPermission()
                .then(function (didIt) {
                    if (didIt) {
                        // Do nothing
                    }
                })
                .catch(function (error) {
                    alert('Error occurred: '+error)
                });
        }

Didn't work for me, any other suggestion?

carpiodanielj avatar Sep 14 '21 17:09 carpiodanielj

I was able to figure out this issue, to get notifications on iOS you must create an Apple Push Services certificate and Apple Push Notifications service (APNs) after that you have to go to your firebase project, go to project settings, cloud messaging, inside the iOS app configuration upload the APNs Auth Key and Development APNs certificate, make sure to add your team id you can find it in your apple developer account, inside the membership. Good luck

DrDaxter avatar Sep 18 '21 17:09 DrDaxter