Device token for an iPhone device生成之后就永远不变吗?
不是,if a device is wiped (应该是重装系统), it will get a new device token.
官方网站是这样写的: If the user restores backup data to a new device or computer, or reinstalls the operating system, the device token changes
正是因为device有可能改变,所以建议在app start时(即在didFinishLaunchingWithOptions 里)调用registerForRemoteNotificationTypes来获取device token以检查device token是否改变,如果改变了就应该把新token传给push provider。(官方描述:An application should register every time it launches and give its provider the current token)
device token应该存储在NSUserDefaults来达到新旧比较的目的
那么旧device token在push provider对应的record怎么办?
方案1:把旧device token send to provider and request delete record
方案2:使用apns feedback service。
方案2可能更好些,因为总是需要使用apns feedback service来处理用户在device里删除app的情况。
调用registerForRemoteNotificationTypes方法后,成功注册后,APNS就会返回一个device token,然后回调delegate method didRegisterForRemoteNotificationsWithDeviceToken, 如果注册失败,则回调delegate method didFailToRegisterForRemoteNotificationsWithError。
注意:
* 在第一次调用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.
上述东东参考官方网站关于Registering for Remote Notifications的讲解
原文地址:
http://blog.csdn.net/totogogo/article/details/7474758
分享到:
相关推荐
Module parse failed: Unexpected token 问题描述 学习React出现的一个问题 从官网拿到的一个例子 class HelloMessage extends React.Component { render() { return ( Hello {this.props.name} ); } } ...
本文实例讲述了JS提示:Uncaught SyntaxError: Unexpected token ILLEGAL错误的解决方法。分享给大家供大家参考,具体如下: Uncaught SyntaxError: Unexpected token ILLEGAL 未捕获的语法错误: 意想不到的非法...
主要介绍了Vue项目报错:Uncaught SyntaxError: Unexpected token <,在引入第三方依赖的 JS 文件时,遇到的一个问题,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
控制台的提示:Uncaught SyntaxError: Unexpected token < 按照提示进入文件,再看如下图: 仔细看了看 index.html 文件,发现原本我的 JS 文件是放在 /src/utils 文件夹下的,但引入 /src 和 /static 的文件是...
前言: 项目使用vue-cli版本2.9.3 ,vue-router...页面全白,console打印:Uncaught SyntaxError:Unexpected token < 报错截图: 经过一番折腾,初步定位问题1在经过build/webpack.prod.conf.js的chunkhash打包后的JS文
主要介绍了vue-cli 打包后提交到线上出现 "Uncaught SyntaxError:Unexpected token" 报错,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
PKCS #11 v2.11: Cryptographic Token Interface Standard
主要介绍了解决vue打包后刷新页面报错:Unexpected token <相关知识点,需要的朋友们参考下。
在使用IAR软件时总是会遇到一些错误,现在将它们汇总,可以直接查阅。
PKCS #9 v2.0: Selected Object Classes and Attribute Types PKCS #9 v2.0 Amendment 1 PKCS #9: Selected Attribute Types PKCS #10 v1.7: Certification Request Syntax Standard PKCS #10: Certification ...
基于token和session的示例 master分支: jwt实现登陆鉴权 token-redis分支: redis数据库管理token实现服务端注销jwt express-jwt分支: express-jwt中间件的使用 session分支: session实现登陆鉴权 session-redis...
使用jmeter对多个接口做业务流程的性能测试,接口包括:获取token接口,获取图片链接口,获取图片验证码接口,获取注册结果接口,最后介绍监听服务器和数据库
iOS 测试推送消息相关工具:为了发送推送,您需要加入一个或多个待推送设备的令牌(Token),一共有三种加入方式:手动输入、文件读取、网络发送。添加令牌时记得为您刚刚添加的令牌命名(可随意起名)。
CSRF token missing or incorrect 具体报错页面如下: 2、有道词典翻译后如下: 通常,当存在真正的跨站点请求伪造时,或者Django的CSRF机制没有被正确使用时,就会出现这种情况。至于邮递表格,你须确保: 您的...
赠送jar包:token-provider-1.0.1.jar; 赠送原API文档:token-provider-1.0.1-javadoc.jar; 赠送源代码:token-provider-1.0.1-sources.jar; 赠送Maven依赖信息文件:token-provider-1.0.1.pom; 包含翻译后的API...
Android/IOS基于token验证服务器端实现,含源码,包括filter 过滤验证token,验证token,账号互踢,根据token获取个人信息到request,controller中如何获取个人信息。
如下sql,JSON_OBJECT函数中存在CAST函数,随后...Caused by: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "SELECT" at line 18, column 10. Was expecting one of: "!" "(" "NOT