How to save the settings in the app when the user

2019-07-25 14:26发布

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条回答
够拽才男人
2楼-- · 2019-07-25 15:00

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?

查看更多
登录 后发表回答