Phonegap-push-plugin not working on iOS

I am having problems with my project.

I have an Ionic project and I use pushgog-push-push to send push notifications. Works fine on Android, but not on iOS. There is no warning about whether I want to receive notifications and the registration event is not running.

What's wrong?

Thanks in advance.

Apple application services

Here is my code:

document.addEventListener('deviceready', function() {
    console.log('>>>>>> DEVICE READY <<<<<<');
    handleNotificationReady();
});

function handleNotificationReady(){
    console.log('>>>> HandleNotificationReady <<<<');
    var pushNotification;

    if (device.platform == 'Android') {
        console.log('>>> Android, nice to meet you!');
        pushNotification = PushNotification.init({
            android: {
                senderID: '6610***',
                icon: 'icon'
            }
        });
    } else if (device.platform == 'iOS') {
        console.log('>>> iOS, nice to meet you!');
        pushNotification = PushNotification.init({
            ios: {
                alert: 'true',
                badge: 'true',
                sound: 'true'
            }
        });
    }

    pushNotification.on('registration', function(data) {
        console.log('>>>> REGISTRATION <<<<');
        console.log(data.registrationId);
    });

    pushNotification.on('notification', function(data) {
        console.log('>>>> NOTIFICATION <<<<');
        console.log(data);
    });

    pushNotification.on('error', function(err) {
        console.log('>>>> ERROR <<<<');
        console.log(err);
    });
}

Here is my console:

`>>>>>> DEVICE READY <<<<<<
>>>> HandleNotificationReady <<<<
>>> iOS, nice to meet you!`
+4
source share
1 answer

I understand your problem.

You tried to remove the push plugin and add it again. Then uninstall and add the iOS platform, re-create the application.

Please try and let me know if this works for you.

+2

Source: https://habr.com/ru/post/1654034/


All Articles