remove iOS push notification after fresh reinstall

时光毁灭记忆、已成空白 提交于 2019-12-05 13:52:04

I guess the best thing you can do is to preventively unregister/remove the tokens, when the app is started without a logged in user. You should update the registration anyways each time the app is started, so register/unregister at each app start, depending on if a user is logged in or not. This way, if the user reinstalls the app and starts it the first time, it will be unregistered.

This is the best behaviour you can achieve, as it is the same for Twitter, Facebook, Skype, etc...

I think you are not able to get an event or detect if a user has removed the app or not. What you can do is to send periodic notifications to a device (only setting the badge, without sending a notification) and remove the tokens for what you get a 401 status code. Then you know the app has been removed and you can delete the token.

Yeah! as you have quoted yourself it will continue to send notification unless your server has the info that someone has logged out. Obviously you won't get the info when your app was uninstalled and then reinstalled.

Workaround: If your app is reinstalled you can call an API to deregister since no user is logged in.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!