0
votes

I have implemented the Passbook websevice, and can successfully push to APNs; But I have a problem with the Passbook not requesting the latest version of the pass. When I push a new notification to a given device, the device gets it and Passbook sends a request the my web service asking for the serial numbers associated with that device. My web service send a response with 200 http status code, whith a JSON payload similar to:

{"lastUpdated":"1424691339", "serialNumbers":["1234567"]}

The device console shows the following:

Feb 23 11:34:54 My-iPhone passd[162] <Warning>: Generating GET request with URL <http://192.168.1.138:8000/api/v1/devices/297f6e6ed478540ccc05e1962cce41e6/registrations/pass.com.example.coupon?passesUpdatedSince=1424690611>
Feb 23 11:34:55 My-iPhone passd[162] <Warning>: Get serial #s task (for device 297f6e6ed478540ccc05e1962cce41e6, pass type pass.com.example.coupon, last updated 1424690611; with web service url http://192.168.1.138:8000/api/) got response with code 200
Feb 23 11:34:55 My-iPhone passd[162] <Warning>: Get serial numbers task completed with update tag 1424691339, serial numbers (
        1234567
    )

I can't see why Passbook does not proceed and request the latest version of the pass. Instead it stops at that point!

Can someone Help please?

1

1 Answers

0
votes

Solved! The Apple docs say that it is required that the serialNumbers entry in the JSON payload must be an array of Strings. This is not enough to make it work. The serial numbers strings must also be quoted for the device to consider them valid. Unfortunately the dumped messages in the device console are of no help to figure this out nor does the documentation. I presume that PassKit converts the string that look like an Integer to NSNumber, when passing the JSON payload, Instead of NSString.

May be if I had other characters than only numbers, this problem wouldn't have occurred.

This is an example of how the JSON payload must look when serial numbers are numbers, duh!

{"lastUpdated":"1424691339", "serialNumbers":["'1234567'"]}