将 Apple 推送通知 (APN) 用于 Passbook 时令牌无效 [英] Invalid token when using Apple Push Notifications (APN) for Passbook

查看:34
本文介绍了将 Apple 推送通知 (APN) 用于 Passbook 时令牌无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为存折 APN 创建服务器端实现,但服务器不喜欢设备给我的推送令牌.如果我将令牌发送到 Apple 的沙箱服务器,它会向我发送无效令牌"响应.如果我将令牌发送到 Apple 的生产服务器,它会在反馈服务中返回令牌作为我应该从列表中删除的令牌.至少我知道 APN 证书和到服务器的连接工作正常.

I am trying to create a server-side implementation for passbook APN, but the server does not like the push token that the device is giving me. If I send the token to Apple's sandbox server, it sends me an "invalid token" response. If I send the token to Apple's production server, it returns the token in the feedback service as one that I should remove from my list. At least I know that the APN certificates and connection to the server work fine.

我的 iPhone 4s 已启用开发.APP ID 为开发和生产启用,设备在配置文件中启用.我已经验证了 32 字节二进制令牌数据对于从设备发送的字符串令牌是正确的.

My iPhone 4s has been enabled for development. The APP ID is enabled for both development and production and the device is enabled in the provisioning profiles. I have verified that the 32 byte binary token data is correct with respect to the string token that is sent from the device.

我的一个问题是,设备中的存折如何确定使用哪个令牌(开发与生产)?我现在更喜欢使用沙箱环境,但我不确定如何选择"它.

One question that I have is, how does passbook in the device determine which token to use (development vs production)? I would prefer to be using the sandbox environment right now, but I'm not sure how to "select" it.

我已经看到了类似的主题,但似乎没有人对这个问题有答案.这真的很令人沮丧,因为我觉得我离完成这项工作很近了!提前感谢您的任何建议!

I have seen similar topics for this but none seem to have the answer for this issue. It is really frustrating as I feel that I'm so close to making this work! Thanks in advance for any advice!

推荐答案

如果您使用生产证书连接到 APN 生产服务器,则必须使用生产令牌.

If you are using a pruduction certificate to connect to the APN production server, you must use a production token.

在向沙箱服务器发送通知时获得无效令牌"这一事实意味着您使用的是生产令牌,该令牌仅适用于生产服务器.

The fact that you get "invalid token" when sending the notification to the sandbox server means you are using a production token, which works only with the production server.

将令牌发送到生产服务器在反馈服务中返回令牌这一事实意味着与证书(您的服务器用于发送通知)匹配的应用程序已从设备上卸载或已禁用推送通知.也许您使用了错误的证书(可能属于从设备上卸载的其他应用的证书).

The fact that sending the token to the production server returns the token in the feedback service means that the application that matches the certificate (which your server is using to send the notification) is either uninstalled from the device or has push notifications disabled. Perhaps you are using a wrong certificate (perhaps a certificate that belong to a different App that was uninstalled from the device).

这篇关于将 Apple 推送通知 (APN) 用于 Passbook 时令牌无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆