简体   繁体   English

通知后端已禁用推送通知的最佳方法是什么?

[英]What is the best way to notify backend that push notifications have been disabled?

What's the best way to notify a backend that a user has disabled push notifications? 通知后端用户已禁用推送通知的最佳方法是什么?

I've been playing around with a few options but I'm not sure which is the best one to proceed with: Option 1: Check if the user has disabled push notifications in the applicationDidFinishLaunching method like this: 我一直在尝试一些选项,但不确定哪一个是最好的选择选项1:检查用户是否已在如下的applicationDidFinishLaunching方法中禁用了推送通知:

UNUserNotificationCenter.current().getNotificationSettings { ... }

The only pitfall to this is let's say a user disables push notifications, and then never reopens the app. 唯一的陷阱是,假设用户禁用了推送通知,然后再也没有重新打开应用程序。 The applicationDidFinishLaunching method will never get called and therefore my app will never realize notifications were disabled and won't act appropriately. applicationDidFinishLaunching方法将永远不会被调用,因此我的应用程序将永远不会意识到通知已被禁用并且无法正常运行。

Option 2: Is there a way backend is able to check if notifications have been disabled? 选项2:后端有没有办法检查通知是否已禁用?

Ok, so after looking through the docs I may have figured it out. 好的,所以在浏览了文档之后,我可能已经知道了。

Apple should send a 410 status code if the device token is no longer active which means that the user must have stopped push notifications or deleted the app. 如果设备令牌不再有效,Apple应该发送410状态代码,这意味着用户必须停止推送通知或删除应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在iOS中处理静默推送通知的最佳方法是什么 - What is the best way to handle silent push notifications in iOS 后端服务器在发生某些事情时通知我的iPhone应用程序的最佳方法是什么? - What's the best way for my backend server to notify my iPhone app when something happens? 有没有办法阻止用户在从Firebase发送后收到推送通知? - Is there a way to prevent users from receiving push notifications after they have been sent from Firebase? 使用Firebase实施推送通知的最佳方式 - Best way to implement push notifications with Firebase 使用NodeJS后端推送通知 - Push Notifications with NodeJS backend 禁用了推送通知的用户是否可以使用具有内容可用的推送通知? - Do Push Notifications with content-available work for users that have disabled Push Notifications? 有没有办法在解析服务器上安排推送通知? - Is there a way to have scheduled push notifications on parse server? 有没有办法为不同的群组提供推送通知 - Is there a way to have push notifications for different groups 如何删除已经发送的推送通知? - How to remove push notifications that have already been sent? 推送通知的最佳解决方案 - Best solution for Push Notifications
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM