Push Notifications on iOS

So i think i am just missing a step. I added the plugin and the code from ngCordova push but the app never prompts me to allow push notifications.

I also created the APP ID in iOS Developer Center and enabled push notifications and created a provisioning profile/linked the certs.

I tried on both a iPhone 5 iOS8 deploying from Xcode and the simulator. What else am i missing?

At least in Android devices, Push Notifications don’t work in emulator, only on a real device. Test if this happens in iOS too.

I tried on an actual phone and the simulator.

It never will when running in debugger on your phone from xCode.
Only when you install the app you get the question.
(Released, Testflight or AD-Hoc install doesn’t matter)

Well thats interesting JesperWe.

Either way i still do not get a success or failure alert on iPhone. This code is fired after the user logins.

  var iosConfig = {
    "badge": true,
    "sound": true,
    "alert": true,
  };
    $cordovaPush.register(iosConfig).then(function(result) {
      // Success -- send deviceToken to server, and store for future use
      alert("result: " + result);
      console.log("result: " + result);
      $http.post("https://website.com/", {user: "Bob", tokenID: result.deviceToken})
    }, function(err) {
      alert("Registration error: " + err)
    });

I had this working using $cordovaPush, but sadly ended up having to switch to window.plugins.pushNotification, because in case the user turned off the push notifications I couldn’t get the error handler to work with out using a try/catch. (just something you may want to test in the future to make sure it works)

Anyway, are you waiting for ionic platform to be ready?
I implemented this code from devgirl’s website:

.factory(("ionPlatform"), function( $q ){
    var ready = $q.defer();

  ionic.Platform.ready(function( device ){
      ready.resolve( device );
  });

  return {
      ready: ready.promise
  }
})

and then wait for ionPlatform.ready to fire before calling register. My register code looks the same as yours and it works fine for me, when installed directly on my iphone from xcode.

Might be on to something here.

I have the code inside ionicPlatform ready in my second controller after login:

ionicPlatform.ready(function() { alert("test");//etc.. push Code });

The alert above never fires. Why is that not being hit?

Hmmm. I think controllers can fire before the ionic platform is ready? I have to do it in my apps .run get it to wait long enough.

Here’s a nice walkthrough:
https://chriztalk.wordpress.com/2015/03/04/iphone-push-notifications-using-ionic-framework/