Ionic push working inconsistently (iOS)



I am having trouble with ios push notifications working consistently. The app registers a push token when you open the app (after permissions accepted) and the app has been live for a while now and iOS push notifications had been working just fine until recently when I started noticing that push notifications weren’t working properly on a build I had launched to TestFlight.

After noticing the notifications were no longer going through, I ran some curl commands using the cloud api :

curl -X POST -H “Authorization:Bearer API_KEY” -H “Content-Type:application/json” -d ‘{“tokens”:[“IOS_TOKEN”],“profile”:“qazingprod”, “notification”:{“message”:“Hello World!”}}’ “

(This works perfect for android devices with the same app)

and checking the status using

curl -H “Authorization: Bearer API_KEY”

I’m getting:

{“meta”: {“status”: 200, “request_id”: “249b025b-1d7c-4ade-ca47-d1f5c8c123b2”, “version”: “2.0.0-beta.0”}, “data”: []}

After uninstalling and re-installing (through testflight) and testing again, using the same cloud api endpoints, the push notifications started to work and I was getting normal responses:

{“meta”: {“status”: 200, “request_id”: “a19ad81b-4afd-4ded-cd3b-8a0d5faa8c9a”, “version”: “2.0.0-beta.0”}, “data”: [{“notification”: “0a2caa90-4c7f-4139-9547-a7e3b308120e”, “status”: “sent”, “error”: null, “created”: “2017-02-07T21:13:21.540439+00:00”, “uuid”: “a8119b75-f271-4ca6-8e53-6a2d1d1bd53a”, “user_id”: null, “token”: {“valid”: true, “created”: “2017-02-07T21:13:21.298353+00:00”, “id”: “12a78de2de3f0f51628ec8a2d9a0a5e4”, “invalidated”: null, “app_id”: “abbe6560”, “token”: “213293600faaac307faae69beb1b04f7440345d485252299b4d4333b3b6402c3”, “type”: “ios”}}]}

After using the app for a little bit however, I noticed the push notifications stopped working once again. Running the same curl commands for the same push token as before, the push notifications weren’t going through and I was getting the bizarre response from checking the status:

{“meta”: {“status”: 200, “request_id”: “249b025b-1d7c-4ade-ca47-d1f5c8c123b2”, “version”: “2.0.0-beta.0”}, “data”: []}

The live version of my app still appears to be accepting push notifications just fine so I’m wondering if this could be related to TestFlight (though I don’t remember having issues with testflight notifications in the past) or if it’s possible something else changed.

Any ideas on why this could happen would be greatly appreciated.


Ionic Push IOS 10 - Problem
Ionic Push GET push/notifications/<notification-uuid>/messages returns empty data