3

I have successfully integrated passkit but I am facing issue when updating passbook via push notification. Notification successfully received to wallet but pass not updated.

Following are steps which I have implemented:

  1. Used XMPP server (PHP).
  2. used this library in php to generate pass (https://github.com/tschoffelen/PHP-PKPass). I have replaced pass type and team identifier.
  3. Swift code to add pass to wallet. Pass successfully created and add to wallet.
  4. To refresh pass "pull to refresh" is working in wallet app.

Here is my full code (PHP + SWIFT): https://www.dropbox.com/sh/e3wk8bwqgv8zs3f/AACZa_x7vD8KByl6WdrrgNExa?dl=0

Here are some logs:

  1. While creating pass: https://www.dropbox.com/s/j14zfudy9mbllmp/add%20card.png?dl=0
  2. Add card on wallet : -https://www.dropbox.com/s/yek9rf8js45p8xb/add%20card%20to%20wallet.png?dl=0
  3. Pull to refresh two request from wallet app https://www.dropbox.com/s/k1sfpxfbqlwwu6q/pull%20to%20refresh%20request%201.png?dl=0 https://www.dropbox.com/s/9jall5xmxpx806o/pull%20to%20refresh%20request%202.png?dl=0
  4. when push notification received, two request from wallet: https://www.dropbox.com/s/sg3v9sgyu0w1e3n/push%20request%201.png?dl=0 https://www.dropbox.com/s/xd2us3771f2xn3s/push%20request%202.png?dl=0

The error is Server response was malformed...

Please help!

Thanks!

Parimal
  • 277
  • 2
  • 8
  • Can you get hold of the raw bundle - you have 2 different content lengths 381636 on the pull and 381635 on the push. – PassKit Jun 21 '17 at 07:22
  • I generating new bundle every time for pull and push. I have not noticed that content lengths. Is 1 byte difference may cause the issue? Have you see the error "Server response was malformed... etc etc" ? – Parimal Jun 21 '17 at 11:02
  • Hello @Parimal, Would you help me for update pass from admin panel? We have added pass successfully to apple wallet but while updating we have received an error. Log from Server Log file. {"logs":["[2018-09-25 11:50:09 +0530] Get serial #s task (for device 49deeaee707d67dbb44ac89480a58124, pass type PASSIDHERE, last updated (null); with web service url http:\/\/pass.abc.com\/admin\/mypkpass\/devices) encountered error: Server response was malformed (The data couldn’t be read because it isn’t in the correct format.)"]} – Jay Mehta Sep 25 '18 at 06:31

1 Answers1

1

I have solved this my self. The problem was in 'Last-Modified' header date format.

It should be header('Last-Modified: ' . gmdate('D, d M Y H:i:s T')); in PKPass.php file

I received push notification and my pass is now updated automatically.

Thanks!

Parimal
  • 277
  • 2
  • 8
  • im having same issue can you please help me ? https://stackoverflow.com/questions/44838318/apple-wallet-not-auto-updating-pass?noredirect=1#comment76770558_44838318 – M.A Jul 07 '17 at 13:52
  • Hey! Sure. Post your details to understand. – Parimal Jul 10 '17 at 11:12
  • do you mind helping me? I'm using most the same resource, not swift though. I have a server page - the passes generated separately. https://stackoverflow.com/questions/45981359/apple-wallet-passkit-pass – Michael Sep 01 '17 at 15:26
  • In my case, error was in Last-Modified format. Correct format is header('Last-Modified: ' . gmdate('D, d M Y H:i:s T')); – Parimal Sep 04 '17 at 08:17