How to save the settings in the app when the user changes the notification settings?

梦想的初衷 提交于 2019-12-24 10:45:05

问题


I implemented push notifications in the AppDelegate.swift class in FCM. Notifications is great, but how do I save the settings in the app when the user changes the notifications settings?


回答1:


You can check notification settings by calling notification delegate method

 let notificationCenter = AppDelegate().getNotificationCenter()
    notificationCenter.getNotificationSettings(completionHandler: { (setting) in
          if(setting.authorizationStatus == .denied){
       })
     }

Public classes for getting notification.

public static var badge: UNAuthorizationOptions { get }

public static var sound: UNAuthorizationOptions { get }

public static var alert: UNAuthorizationOptions { get }

public static var carPlay: UNAuthorizationOptions { get }

for more : https://developer.apple.com/reference/usernotifications/unauthorizationoptions

let me know is it helpful or not?



来源:https://stackoverflow.com/questions/42618144/how-to-save-the-settings-in-the-app-when-the-user-changes-the-notification-setti

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