Javascript PushWoosh通知回调未触发

Javascript PushWoosh通知回调未触发,javascript,ios,cordova,push-notification,pushwoosh,Javascript,Ios,Cordova,Push Notification,Pushwoosh,这是我的密码。当我的应用程序被终止并在推送通知时重新启动时,它应该正确重定向,但是它实际上从未进入推送通知。notificationCallback=functionevent不知道为什么 function initPushWoosh() { try { checkNetworkConnection(); if(!window.plugins) {

这是我的密码。当我的应用程序被终止并在推送通知时重新启动时,它应该正确重定向,但是它实际上从未进入推送通知。notificationCallback=functionevent不知道为什么

function initPushWoosh() {
                try {
                    checkNetworkConnection();

                    if(!window.plugins) {
                        wodifyRedirect('unknown-' + device.token);
                        return;
                    }

                    var pushNotification = window.plugins.pushNotification;
                    pushNotification.notificationCallback = function(event) {
                        var notificationId = 0;
                        if(event.u && event.u.custom) {
                            notificationId = event.u.custom;
                        } else if(event.u) {
                            notificationId = JSON.parse(event.u).custom;
                        } else if(event.custom && event.custom.custom) {
                            notificationId = event.custom.custom;
                        } else if(event.custom) { 
                            notificationId = JSON.parse(event.custom).custom;
                        }

                        if(event.onStart && notificationId != 0) {
                            navigateToNotifications(notificationId, device.uuid);
                        }
                    };

实际上,Pushwoosh定义了自己的通知回调:

PushNotification.prototype.notificationCallback = function(notification) {
            var ev = document.createEvent('HTMLEvents');
            ev.notification = notification;
            ev.initEvent('push-notification', true, true, arguments);
            document.dispatchEvent(ev);
    };
这可以通过以下方式处理:

document.addEventListener('push-notification', function(event) {
请参见此处的Pushwoosh示例应用程序: