Ios PushPlugin registered but can't get push


#1

ios PushPlugin registered but can’t get push :

I works with a real device and xcode5.
I created certificat and provising profiles.

I have a nodeJs Server with a node Module that send push to my phone’s token with that log :

[Thu Aug 14 2014 16:20:13 GMT+0200 (CEST)] Send : aa0a646f29c7dda8c5fc4a7882d8765a027a268299ac32fbba7f76976db3d01f
[Thu Aug 14 2014 16:20:13 GMT+0200 (CEST)] open socket

(errors callback doesn’t trigger)

I have an app that can register for push with a token associated to an iphone returned,
“ecb” onNotificationAPN doesn’t trigger, my code :

app.controller('ctrl-landing', function ($scope, $state, $ionicPlatform) {

  $ionicPlatform.ready(function () {

    console.log('__________landingCtrl__________ ready');

    var pushNotification = window.plugins.pushNotification;

    pushNotification.register( function (x) {
      console.log("tokenHandler :");
      console.log(x);
    }, function (x) {
      console.log("errorHandler :");
      console.log(x);
    }, {
      "badge":"true",
      "sound":"true",
      "alert":"true",
      "ecb":"onNotificationAPN"
    });

    var onNotificationAPN = function (event) {
      console.log("EVENT FROM PUSH :");
      console.log(event);
      if ( event.alert ) {
        navigator.notification.alert(event.alert);
      }
    }

  });

and i note that in plugin native interface :

- (void)notificationReceived {
NSLog(@"Notification received");

This doesn’t log in xcode console where it should be.

So I don’t know where is the problem :

  • maybe from plugin utilisation
  • maybe from module that send push
  • maybe from provisioning profile in xcode5

Thanks for help :wink:


#2

Oh i got it work…

My node module to send push is https://www.npmjs.org/package/apns but it didn’t confirm push success.
I tried it to test https://www.npmjs.org/package/apns_test, it send push from my computer and gave me errors with my cert and key. I convert .p12 files into .pem files and my “ecb” in app trigger well.

Sorry for stupid error :blush:


#3

Hi @rdb,

I install cordova push notification plugin.
I am not able to get token in IOS. Can you help me how can i get token?

Thanks.


#4

Hello,

Do you get this message ?

“no valid ‘aps-environment’ entitlement”


#5

Thanks for reply …
yes i am getting “no valid ‘aps-environment’ entitlement” error.


#6

Can you tell me what is the solution ??


#7

You have a problem with your certificate.

It’s better to restart all the process with this tuto : http://stackoverflow.com/questions/21250510/generate-pem-file-used-to-setup-apple-push-notification#answer-21253261