我在将 Apple Wallet 的 Apple 推送通知与我的 Web 服务集成时遇到了问题。
什么有效:
- 端点(如 https://developer.apple.com/library/content/documentation/PassKit/Reference/PassKit_WebService/WebService.html 中所述);
- 通行证有效,它们适用于 iPhone,注册、手动更新、注销等似乎都有效,我的服务器日志没有错误;
- 来自“获取最新版本的通行证”端点的响应具有“上次修改” header 。
然后我在服务器上更新一个通行证。当我尝试发送推送通知时,没有任何反应。
我做了一些调试,APN 服务器 ( https://api.push.apple.com:443 ) 返回代码 200,主体为空,“apns-id” header 为非空。这看起来不错 ( https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingwithAPNs.html )。
但是!我的 iPhone 上的钱包中既没有通知也没有更新的通行证。
当我进行手动更新时,通行证更新并显示更新通知。
我无法理解我做错了什么......
附言我用 https://github.com/mdigger/apns向 APNS 发出请求。
最佳答案
当连接到 APNS 以进行钱包更新时,您需要连接用于签署通行证的同一通行证类型 ID 证书。
请参阅部分:
Your Server Sends a Push Notification When Something Changes
Your server sends the following pieces of information:
- The pass type identifier (in the certificate)
- The push token (in the communication to the Apple Push Notification service)
关于ios - 钱包中的 Apple Pass 不会在推送通知时更新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47537835/