Cordova iOS app using phonegap-plugin-push not registering or requesting authorization

412 Views Asked by At

I have a Cordova (vers 9) app that uses phonegap-plugin-push (v2.3.0) on cordova-ios (v4.5.1) that does not register for notifications when run on an iOS device, (iPad mini iOS 9.3.5). I am using Xcode (vers 8) within MacOSX Sierra. The xcode project Capabilities tab has push notifications turned on, the project builds without error and the App ID configuration has Push Notifications enabled with a valid certificate. Additionally, it does not show as having access to notifications in the settings for the app on the iOS device nor does it prompt for access when run.

How do I narrow down where the registration problem is? Does the device I am running it from have anything to do with it? Am I missing a call that requests access to notification in the code? Am I missing an error routine that might let me know what the problem is?

Actions I have taken:

Uninstalled/reinstalled cordova

Uninstalled/reinstalled ios

Uninstalled/reinstalled phonegap-plugin-push

Changed order they are added

Fixed numerous build errors that prevented the app from building or signing.

Placed app into debugger and stepped through Javascript code where register takes place.

Exported provision profile from release build and examined to ensure entitlement is present.

var app = 
{
   // Application Constructor
   initialize: function ()
    {
        this.bindEvents();
    },
    // Bind Event Listeners
    //
    // Bind any events that are required on startup. Common events are:
    // 'load', 'deviceready', 'offline', and 'online'.
    bindEvents: function ()
    {
        console.log( 'mobile-rewards:  bindEvents() called' )
        document.addEventListener( 'deviceready', this.onDeviceReady, false );
    },
    // deviceready Event Handler
    //
    // The scope of 'this' is the event. In order to call the 'receivedEvent'
    // function, we must explicitly call 'app.receivedEvent(...);'
    onDeviceReady: function ()
    {       
        const push = PushNotification.init(
        {
            android: 
            {
            },
            browser: 
            {
                pushServiceURL: 'http://push.api.phonegap.com/v1/push'
            },
            ios: 
            {
                alert: "true",
                badge: "true",
                sound: "true"
            },
            windows: {}
        });
        // e.message
        push.on('error', function(e) 
        {
            console.log(e.message);
        });
        push.on('registration', function(deviceInfo)
        {
            console.log("device info - "+deviceInfo.registrationType+":"+deviceInfo.registrationId);
        });
        push.on('notification', function(data)
        {
            console.log(data.message);
        });

},

};

// initialize the app.
app.initialize();


I expected the plugin to register successfully but it doesn't appear to have done so.  There is no error present coming from the error handler and the plugin appears to function normally.  The debug output log from the plugin shows progress through the entire PushPlugin.m code for the init.  The exported app shows the aps-environment provision within it for production.  However, the application neither returns a registration ID, prompts for notification access, nor shows up as even needing these privileges in the settings.
0

There are 0 best solutions below