I have an issue with Push Notification for iOS in production mode.
I first developed Push for development:
- created dev provisioning profile on Mac
- created dev certificate on Mac
- created a dev security profile in Ionic Dashboard
- added dev certificate to dev security profile Ionic dashboard
All worked fine for Android as well as iOS.
I then switched to production:
- created provisioning profile and certificate for live on Mac
- created a live security profile in Ionic Dashboard and added live certificate
I always test Push using Postman:
send POST to https://api.ionic.io/push/notifications
with body:
{
"tokens": [
"<ios token>",
"<android token>"
],
"profile": "live",
"notification": {
"message": "test",
"ios": {
"priority": 10
},
"android": {
"priority": "high"
}
}
}
response:
{
"data": {
"status": "open",
"config": {
"profile": "live",
"notification": {
"android": {
"priority": "high"
},
"ios": {
"priority": 10
},
"message": "test"
},
"tokens": [
"<ios token>",
"<android token>"
]
},
"created": "2017-02-14T15:07:58.988762+00:00",
"app_id": "<app id>",
"uuid": "<uuid>",
"state": "enqueued"
},
"meta": {
"status": 201,
"request_id": "<request id>",
"version": "2.0.0-beta.0"
}
}
To see what's going on, I always send a GET afterwards to https://api.ionic.io/push/notifications/
<uuid>
/messages
(uuid
from the first response) and get the following response:
{
"data": [
{
"status": "sent",
"created": "2017-02-14T15:07:59.165266+00:00",
"user_id": null,
"token": {
"token": "<android token>",
"valid": true,
"type": "android",
"app_id": "<app id>",
"invalidated": null,
"id": "<id>",
"created": "2017-02-14T14:27:27.585235+00:00"
},
"error": null,
"notification": "<notification uuid>",
"uuid": "<message uuid>"
}
],
"meta": {
"status": 200,
"request_id": "<request id>",
"version": "2.0.0-beta.0"
}
}
I noticed that the data for the corresponding <ios token>
is missing in the response.
I'm wondering why there isn't even an error response as listed at Ionic Docs.
If I send both requests using the dev security profile I get data for iOS stating "error" (APNS_BAD_DEVICE_TOKEN
) - which is correct.
I already tried re-creating the certificate and stuff, which does not change the result. I also waited a whole day to receive a notification, in case something takes really long. I made double sure I built the app with the correct profiles in Xcode.
I'm using Xcode 8.2 by the way - and definetly made sure to enable "Push Notifications" in capabilities.
What am I missing?