设备标记处收到即使iPhone未连接到互联网 [英] Device Token Received even after iPhone is not connected to Internet

查看:556
本文介绍了设备标记处收到即使iPhone未连接到互联网的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是测试我的iOS应用程序我发现一个有趣的事情,连我的手机处于飞行模式,我也关闭WIFI,我的应用程序能够推送通知注册后接收设备令牌。

I was testing my iOS app I found one interesting thing that even my phone is in airplane mode and I have also switched off WIFI, my app is able to receive the the Device Token after registering for push notification.

我也甚至删除应用程序,并从iPhone其关联的证书后尝试。

I have also tried even after removing app and its associated certificate from the iPhone.

但得到了相同的结果。

这怎么可能,任何想法?

How is it possible, any idea ?

先谢谢了。

推荐答案

这是从APNS编程指南:

This is from the APNS programming guide :

通过请求设备令牌,并将其传递给每一个供应商
  计时您的应用程序启动,你帮助确保供应商
  有该设备的当前令牌。如果用户恢复一个备份到
  设备或计算机比备份为创建的一个其它
  (例如,用户将数据迁移到新的设备或计算机),他
  或她必须至少一次启动应用程序,它接收
  再次通知。如果用户备份数据还原到一个新的设备
  或计算机,或重新安装操作系统,设备令牌
  变化。而且,从来没有缓存的设备令牌,并把那个给你
  供应商;总是从系统中获得令牌,只要你需要它。
  如果您的应用程序previously注册,呼吁registerForRemoteNotificationTypes:在操作系统结果
  立即通过设备令牌委托,而不会产生
  额外的开销。

By requesting the device token and passing it to the provider every time your application launches, you help to ensure that the provider has the current token for the device. If a user restores a backup to a device or computer other than the one that the backup was created for (for example, the user migrates data to a new device or computer), he or she must launch the application at least once for it to receive notifications again. If the user restores backup data to a new device or computer, or reinstalls the operating system, the device token changes. Moreover, never cache a device token and give that to your provider; always get the token from the system whenever you need it. If your application has previously registered, calling registerForRemoteNotificationTypes: results in the operating system passing the device token to the delegate immediately without incurring additional overhead.

这意味着,如果你的应用程序已经注册了推送通知,称 registerForRemoteNotificationTypes 不访问APNS服务器。

It implies that if your application is already registered for push notifications, calling the registerForRemoteNotificationTypes doesn't access the APNS server.

这是您卸载该应用程序不会从APNS注销它的事实。您可以通过卸载该应用后,立即致电反馈服务证明自己。你不会得到在这种情况下,反馈服务的设备令牌,因为APN服务不知道您卸载该应用程序。只有当你卸载应用程序后,将通知发送到设备的APN服务将知道应用程序卸载。

The fact that you uninstalled the app doesn't unregister it from APNS. You can prove that to yourself by calling the feedback service immediately after uninstalling the app. You wouldn't get the device token from the feedback service in this case, because the APN service doesn't know you uninstalled the app. Only if you send notifications to the device after uninstalling the app, the APN service will know the app was uninstalled.

这篇关于设备标记处收到即使iPhone未连接到互联网的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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