开发者

Apple Remote Notifications - Handle Token change

开发者 https://www.devze.com 2023-03-20 12:51 出处:网络
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 rig

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?

According to this: http://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/IPhoneOSClientImp/IPhoneOSClientImp.html#//apple_ref/doc/uid/TP40008194-CH103-SW2

Thanks


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号