Pregunta

I'm trying to send some push notifications with the Passbook API. I've created the following JSON object that I send to the APNS server:

$payload = json_encode(array('aps' => array('alert' => 'Hello World!')));

However, this message does not arrive. I've been searching on internet on how to do this when using Passbook, but I can't find it. When I send an empty payload like this:

$payload = json_encode(new ArrayObject());

the (update) notification arrives and the pass gets updated.

So, does anyone know how I should send a custom message to the APNS server?

Thanks in advance!

¿Fue útil?

Solución

Passbook specifically ignores the payload of the push notification. It ignores it on purpose so changes don't get missed if push notifications are missed.

Passbook uses the notification simply as a signal to tell it to update the pass with the PassIdentifier contained in the cert that the push notification is signed with.

Once it receives a notification (again, regardless of payload) it just sends a GET request to the webserviceURL for the pass associated with the DeviceID and the serialNumber. It also adds a query parameter passesUpdatedSince if it previously requested an update. If this is the first time it is requesting an update that query parameter won't be present.

So, in summary, you are actually not supposed to send custom JSON payloads to Passbook passes through push notifications, in contrast to classic push notifications where you are talking to your own app.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top