获取新的Apple设备令牌? [英] Obtain NEW Apple device token?

查看:159
本文介绍了获取新的Apple设备令牌?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个应用程序,允许用户注销该应用程序,并根据需要以其他用户身份登录.新用户登录后,是否可以从Apple获得新设备令牌?有没有办法强制调用didRegisterForRemoteNotificationsWithDeviceToken方法?

I am creating an app that allows the user to log out of the app and log in as different user if they want to. Is there any way to obtain a new device token from Apple once the new user logs in? Is there a way to force call the didRegisterForRemoteNotificationsWithDeviceToken method?

推荐答案

否,您不能请求新的设备令牌.它们会不时到期,只有这样,您才能得到一个新的(或者,如果您拥有具有不同捆绑软件ID的其他应用程序,则令牌也会有所不同.)

No, you can't request a new device token. They expire from time to time, and only then will you get a new one (or if you have a different app with a different bundle id, the token will be different).

创建一个处理didRegister的函数,然后从didRegisterForRemoteNotificationsWithDeviceToken中调用该函数.然后在需要强制调用时使用该功能.

Create a function to handle didRegister and call that from didRegisterForRemoteNotificationsWithDeviceToken. Then use that function when you need to force the call.

由于用户正在登录,因此每次有人登录时,将带有设备令牌的信息传递给服务器,并将用户与服务器端的令牌相关联.

Since users are logging in, pass the information with the device token to the server every time someone logs in and associate the user to the token on the server side.

这篇关于获取新的Apple设备令牌?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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