Push notification is not working in ios


#1

Hi friends…

           I am using ionic push for iphone and iPad. 
           I am following the steps from ionic push site.
           I am not able to get the device token. here is my code

     $ionicPlatform.ready(function() {
              var push = new Ionic.Push({
                "debug": true,
                 "onNotification": function(notification) {
                    var payload = notification.payload;
                    console.log(notification, payload);
                  },
                  "onRegister": function(data) {
                    console.log(data.token);
                  },
                  "pluginConfig": {
                    "ios": {
                      "badge": true,
                      "sound": true
                     },
                     "android": {
                       "iconColor": "#343434",
                       "badge": true,
                       "sound": true
                     }
                  } 
              });
              push.register(function(token) {                    
                   console.log("Device token:",token.token);                        
                   push.saveToken(token);  // persist the token in the Ionic Platform
              });
            });

Can any one help me out this?

Note: This code works well in android.

Thanks in Advance


#2

Use PushNotification.init({…}) instead of new Ionic.Push({…});

It will work:slight_smile: