didRegisterForRemoteNotificationsWithDeviceToken - 推送通知 [英] didRegisterForRemoteNotificationsWithDeviceToken - Push Notifications

查看:248
本文介绍了didRegisterForRemoteNotificationsWithDeviceToken - 推送通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想确认didRegisterForRemoteNotificationsWithDeviceToken是指被称为每次应用程序加载和我的PHP服务器或应用程序需要处理是否要重新提交我的数据库来存储?或者是有什么我失踪?

I just wanted to confirm "didRegisterForRemoteNotificationsWithDeviceToken" is meant to be called everytime the application loads and my PHP server or application needs to deal with whether or not to resubmit to store in my database? Or is there something I am missing?

谢谢
詹姆斯

推荐答案

首先,你是不是要直接调用此方法。相反,你应该叫 registerForRemoteNotificationTypes:在每次启动您的应用程序,然后依次调用应用程序:didRegisterForRemoteNotificationsWithDeviceToken:您必须实现。

First, you are not meant to call this method directly. Rather, you should call registerForRemoteNotificationTypes: on every launch of your app which then in turn calls application:didRegisterForRemoteNotificationsWithDeviceToken: which you must implement.

二,是的,​​你应该每次令牌重新提交给服务器。从文档:

Second, yes, you are supposed to resubmit the token to your server every time. From the documentation:

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

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 other than the one that the backup was created for (for example, the user migrates data to a new device), 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 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 iOS passing the device token to the delegate immediately without incurring additional overhead.

这篇关于didRegisterForRemoteNotificationsWithDeviceToken - 推送通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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