ios - 为什么我的 app,在断网情况下,也能收到苹果返回的 deviceToken?
ringa_lee
ringa_lee 2017-04-18 09:29:41
[iOS讨论组]

我把测试机上的app删除了

然后在appdelegate中的didRegisterForRemoteNotificationsWithDeviceToken方法打上断点

然后把测试机断wifi并飞行,然后运行

我的 app 还是能收到 deviceToken。

这是为什么呢,deviceToken 的获取不是必须在联网状态下么?

ringa_lee
ringa_lee

ringa_lee

全部回复(2)
高洛峰

*在第一次调用registerForRemoteNotificationTypes方法时没有联网,则既不会调用didRegisterForRemoteNotificationsWithDeviceToken,也不会调用didFailToRegisterForRemoteNotificationsWithError

*在第一次调用registerForRemoteNotificationTypes注册成功后,之后即使没有联网,再调用registerForRemoteNotificationTypes时都会以最上一次的device token作为参数回调didRegisterForRemoteNotificationsWithDeviceToken方法。

  • (官方描述) 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.

非原创

大家讲道理

应该是缓存的,请求不是每次都

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号