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

查看:279
本文介绍了使用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天全站免登陆