[英]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:后端有没有办法检查通知是否已禁用?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.