Pregunta

I am building a passbook webservice that will permits to generate and manage coupon,passes for the Passbook application. I am building this web service in ruby on rails.

I meet a problem when I try to send notification after an update of a pass. I can see that the notification is received in the Xcode console of my iphone. Here is the output:

Dec 13 14:57:33 iPhone-de-J passd[543] <Warning>: Received push for topic pass.ch.passbook.poc: {
    aps =     {
        alert = "Hello toto";
        badge = 42;
        "content-available" = 1;
        sound = "siren.aiff";
    };
}
Dec 13 14:57:33 iPhone-de-J passd[543] <Warning>: Generating GET request with URL <http://myhome:3000/v1/devices/3517d0a9f92d3f7859897af515de8b11/registrations/pass.ch.passbook.poc?passesUpdatedSince=1386942680>
Dec 13 14:57:33 iPhone-de-J passd[543] <Warning>: Get serial #s task (for device 3517d0a9f92d3f7859897af515de8b11, pass type pass.ch.passbook.poc, last updated 1386942680; with web service url http://myhome:3000) got response with code 200
Dec 13 14:57:33 iPhone-de-J passd[543] <Warning>: Get serial numbers task  completed with update tag 1386943049, serial numbers (
    45
)
Dec 13 14:57:33 iPhone-de-J passd[543] <Warning>: Generating GET request with URL <http://myhome/v1/passes/pass.ch.passbook.poc/45>
Dec 13 14:57:33 iPhone-de-J passd[543] <Warning>: Request contains header   field <Authorization: ApplePass secretsecretsecret>
Dec 13 14:57:33 iPhone-de-J passd[543] <Warning>: Request contains header   field <If-Modified-Since: Fri, 13 Dec 2013 13:51:20 GMT>
Dec 13 14:57:35 iPhone-de-J passd[543] <Warning>: Get pass task (pass type  pass.ch.passbook.poc, serial number 45, if-modified-since Fri, 13 Dec 2013 13:51:20  GMT; with web service url http://myhome:3000) got response with code 200
Dec 13 14:57:35 iPhone-de-J passd[543] <Warning>: Verifying structure andsignature for pass pass.ch.passbook.poc/45
Dec 13 14:57:35 iPhone-de-J passd[543] <Warning>: Signature validation: succeeded
Dec 13 14:57:35 iPhone-de-J passd[543] <Warning>: Verifying structure and signature for pass pass.ch.passbook.poc/45
Dec 13 14:57:35 iPhone-de-J passd[543] <Warning>: Signature validation: succeeded

All seems to have the right behavior. However, nothing is displayed on my iphone. Note that I am using the grocer gem to send notification to APNS and it seems to work in view of the first line of the console.

¿Fue útil?

Solución

For a notification to be displayed, 3 things need to be in place.

  1. The field dictionary must contain a changeMessage key,
  2. The field changeMessage value must contain %@ (otherwise a generic Pass Changed message will be displayed),
  3. The field value in the updated pass must be different to the value in the pass that it is replacing.

Your Xcode log implies that your web service is functioning correctly.

Anything in the APNS payload is ignored. The push only serves as a trigger to request the device to contact the web service.

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