Ionic Push - not getting token on device


#1

Taken from Stackoverflow, I really hope you guys can help.
I can’t seem to get Ionic Push to work, the last 3 days i have done the “Push From Scratch” and IOS setup tutorials over and over.

I can send dev pushes to the device - they show up fine as alerts, but when I switch to send the pushes via the APN using the development certificate things go wrong. Using the log I can see that $cordovaPush.register (in the ionic-push.js file) fails in some way, but strangely enough it does not write any errors (or success messages for that matter) to the xcode console. See the snippet below:

if (app.dev_push) {...} else {
 console.log('before');
            $cordovaPush.register(config).then(function (token) {
                console.log('$ionicPush:REGISTERED', token);

                defer.resolve(token);

                if (token !== 'OK') {

                    $rootScope.$emit('$cordovaPush:tokenReceived', {
                        token: token,
                        platform: 'ios'
                    });

                    // Push the token into the user data
                    try {
                        $ionicUser.push('_push.ios_tokens', token, true);
                    } catch (e) {
                        console.warn('Received push token before user was identified and will not be synced with ionic.io. Make sure to call $ionicUser.identify() before calling $ionicPush.register.');
                    }
                }
            }, function (err) {
                console.error('$ionicPush:REGISTER_ERROR', err);
            });
            console.log('after');

And here is the log:

2015-07-20 20:13:23.530 PassionApp[4419:727003] DiskCookieStorage changing policy from 2 to 0, cookie file: 

file:///private/var/mobile/Containers/Data/Application/686516FA-FA77-4D78-AE1B-08A245D0C06F/Library/Cookies/Cookies.binarycookies
2015-07-20 20:13:24.170 PassionApp[4419:727003] Apache Cordova native platform version 3.8.0 is starting.
2015-07-20 20:13:24.174 PassionApp[4419:727003] Multi-tasking -> Device: YES, App: YES
2015-07-20 20:13:24.200 PassionApp[4419:727003] Unlimited access to network resources
2015-07-20 20:13:24.618 PassionApp[4419:727003] [CDVTimer][keyboard] 0.677943ms
2015-07-20 20:13:24.619 PassionApp[4419:727003] Init FacebookConnect Session
2015-07-20 20:13:24.659 PassionApp[4419:727003] [CDVTimer][facebookconnectplugin] 39.842010ms
2015-07-20 20:13:24.660 PassionApp[4419:727003] [CDVTimer][TotalPluginStartup] 42.838991ms
2015-07-20 20:13:25.639 PassionApp[4419:727003] active
2015-07-20 20:13:25.734 PassionApp[4419:727003] Attempting to badge the application icon but haven't received permission from the user to badge the application
2015-07-20 20:13:26.277 PassionApp[4419:727003] Resetting plugins due to page load.
2015-07-20 20:13:27.918 PassionApp[4419:727003] Finished load of: file:///private/var/mobile/Containers/Bundle/Application/3BB4429C-2615-4136-A122-7496C351917C/PassionApp.app/www/index.html#/app/intro

2015-07-20 20:13:29.641 PassionApp[4419:727003] THREAD WARNING: ['Device'] took '15.608154' ms. Plugin should use a background thread.

2015-07-20 20:13:29.904 PassionApp[4419:727003] THREAD WARNING:
 ['PushPlugin'] took '33.658936' ms. Plugin should use a background thread.

2015-07-20 20:13:29.907 PassionApp[4419:727003] before

2015-07-20 20:13:29.908 PassionApp[4419:727003] after

I realise that the apn call may be async, but this is the last entry in the log.

I am using xcode 6.4, the test device is an iphone 4s running the latest released iOS.


#2

I fixed it.
For some reason the Xcode project did´t use the right provision profile, I deleted everything and startet over - that did the trick.