重新安装后删除iOS推送通知 [英] remove iOS push notification after fresh reinstall

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

问题描述

我有一个成功集成苹果推送通知的应用程序,当用户登录到应用程序应用程序注册推送通知并且令牌保存在我们的后端时,当用户退出应用程序时,我们删除推送通知来自我们后端的令牌.但是如果用户在没有从应用程序退出的情况下从设备卸载应用程序,然后重新安装,在这种情况下我们仍然可以向设备发送推送通知,因为应用程序是新安装的并且没有登录任何用户,我们必须删除令牌从后端.由于 iOS 应用程序没有任何用于卸载事件的 API,我该如何从后端删除设备令牌.我可以使用推送通知反馈服务来获取已卸载的设备令牌,但是当用户删除应用程序然后重新安装时如何解决该问题.

I have application which has successfully integrated apple push notifications, when user logs in to the application app registers with the push notification and token is saved on our back-end, when user sign out from the app, we remove the push notification tokens from our back-end. but if user uninstall app from the device WITHOUT SIGN-OUT from app, and then re-install,in that case we can still send push notifications to the device, since app is newly installed and not logged in any user we have to remove tokens from the backend. since iOS app does not have any API for uninstallation events how can I remove device token from back-end. I can use push notification feedback service to get uninstalled device tokens but how can I resolve the issue when user removes the application and then reinstall.

我用Skype测试了这个场景,它也有这个问题.(安装 Skype > 登录 >(现在您可以将应用程序发送到后台并从任何其他设备发送一些聊天,您将收到推送通知)> 然后从设备中删除应用程序而无需从 Skype 注销 > 重新安装 Skype > 现在如果我们发送Skype聊天我们收到推送通知但Skype应用程序是新安装的并且没有人登录)

I tested this scenario with skype, it also have this issue. (install Skype > Log In > (now you can send app to Background and send some chats from any other device, you will get push notifications) > then Remove app from Device without Sign-Out from Skype > Re-Install Skype > now if we send skype chat we receives push notifications but skype app is newly installed and no one is logged in)

推荐答案

我想你能做的最好的事情就是在没有登录用户的情况下启动应用程序时预防性地取消注册/删除令牌.每次启动应用程序时,您都应该更新注册,因此在每次应用程序启动时注册/取消注册,具体取决于用户是否登录.这样,如果用户重新安装应用并第一次启动它,它就会被注销.

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.

这是您可以实现的最佳行为,因为 Twitter、Facebook、Skype 等也是如此...

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

这篇关于重新安装后删除iOS推送通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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