phonegap-plugin-push does not work on iOS

Asked

Viewed 198 times

1

Good afternoon to all!

I have an IONIC project where I am using phonegap-plugin-push to send Push notifications. Android is working very well, but iOS does not work. Alert does not appear asking if I want to receive notifications and Registration Event is not executed.

I’ve already enabled Push Notifications on Apple Developer, I’m using the right Provisioning and the right P12 Certificates.

My code is this:

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);
    });
}

And the console:

`>>>>>> DEVICE READY <<<<<<
>>>> HandleNotificationReady <<<<
>>> iOS, nice to meet you!`

According to the log, it runs INIT, but does not get to Register.

Can someone tell me what’s wrong.

Thank you!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.