Push notification doesn't work on ios

I implemented ionic push within my application. It works fine in android, but does not in ios.

All my certificates are ok. Even I get the allow notification access when I open the app and generate the token successfully:

Ionic Push: saved push token: My_Token

But I don’t receive any notifications. (tested in both ios9 and ios10)

But you are receiving a real token, not My_Token, right?
Where are you testing? Emulator or real devices?

Yes, real token.
Testing in real device.

There is note in ionic docs:

In order to receive background push notifications, you must first enable Remote Notifications in your app.

I build my app by ionic package service. I’m not sure this feature is applied in ionic package or not!

The push plugin should do that as far as I know. If you want to make sure and ask someone:
(Scroll down to “Business and Customer Support”)

But I don’t think the problem is related to that. Because I even don’t get notification (or trigger event) when app is open.

How are you sending the push?
What is the status of the push after sending?

I’m sending by ionic dashboard (for both android and ios).

About the status, ionic dashboard doesn’t show anything. I must test it with sending by ionic api.

(I think you should get an ID after sending with the UI as well and only have to check the status useing the API if I rememer correctly)

Right. But ionic dashboard seems have a problem. For all push messages (even in android that works fine) gives me this message:

This notification may still be processing, try back again later

There is a code in ionic docs about ios:

push.on('notification', function(data) {
        // do something with the push data
        // then call finish to let the OS know we are done
        push.finish(function() {
            alert("processing of push data is finished");
            }, function() {
                alert("something went wrong with push.finish for ID = " + data.additionalData.notId)
        }, data.additionalData.notId);

But where push is defined? (Scroll up a bit this link to see the code)


DI, as always.

1 Like


You mean I should do this:

var push = $ionicPush.register().then(function(t) {
  return $ionicPush.saveToken(t);
}).then(function(t) {
  console.log('Token saved:', t.token);

Or only var push = $ionicPush; ?

I get the following error:

Error: $ionicPush.on is not a function.

Oh sorry, I missed that you are on Ionic v1 - the FAQ entry only shows code for Ionic 2 I think. Switching between v1 and v2 in the docs makes no difference.

For you push would probably be $ionicPush.

But I get error in on method:

Error: $ionicPush.on is not a function.

(Scroll down to “Business and Customer Support”)

1 Like

Finally I migrated to onesignal. Now it works fine. Thanks for your support @Sujan12

1 Like

Just migrate your Push Notifications to OneSignal, it’s the most flexible and serious free provider. https://onesignal.com/

1 Like

Yes, I mentioned about it, in last reply. Thanks.