passkit - pass not refreshing via push notification. (Server response was malformed)

半城伤御伤魂 提交于 2020-01-01 17:28:29

问题


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!


回答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!



来源:https://stackoverflow.com/questions/44668916/passkit-pass-not-refreshing-via-push-notification-server-response-was-malfor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!