Apple 远程通知 - 处理令牌更改
我需要在我的 iPhone 应用程序中通过 APNS 使用通知。
但当我阅读规范时,我发现令牌可以在 APNS 端更改,并且我必须更新提供商端的令牌才能正确接收通知。
但是,当 Provider 创建通知并将其传递给 APNS 并且此时令牌已经更改时会发生什么?
我会收到旧令牌的通知吗?提供商会收到令牌过期的通知吗?
我是否应该解决这个问题,以便在注册后我将使用信息“您可以发送通知”更新我的提供商,并创建一个 NSTimer 作业来在应用程序运行时更新此状态?
谢谢
I need to use Notifications via APNS in my iPhone App.
But as I read specification, I see the Token can be changed on APNS side and I have to update token on Provider side to receive notifications right.
But what will happen when Provider creates Notification and will pass it to APNS and in this time the token will be already changed?
Will I receive a Notification with old token? Will provider be notified that token expired?
Should I solve it so, that after registering I will update my Provider with info "YOU CAN SEND NOTIFICATIONS" and make a NSTimer job to update this state while app is running?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您的应用程序在启动时注册通知,并实现文档中指定的方法,那么它一定会获得正确的令牌。
如果您的应用程序跟踪令牌的过去,它可以根据需要向提供者发送更新(或者每次获取令牌时,无论令牌是否已更改)。
如果令牌已更改,并且提供者尝试使用旧令牌进行推送,则推送通知服务器将通知提供者该令牌无效。
If your app registers for notifications at launch, and implements the methods specified in the documentation, it will be sure to get the correct token.
If your app keeps track of what the token used to be, it can send an update to the provider as needed (or just every time it gets a token whether it has changed or not).
If the token has changed, and the provider tries to push using the old token, the provider will be notified by the push notification server that the token is not valid.