Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Obtain NEW Apple device token?

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?

like image 217
dbarrett Avatar asked Oct 27 '25 11:10

dbarrett


2 Answers

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).

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.

like image 110
Millie Smith Avatar answered Oct 29 '25 01:10

Millie Smith


There is no way to get a different device token. You need to remove the token from the backend when the user logs out.

like image 33
respectTheCode Avatar answered Oct 28 '25 23:10

respectTheCode