1

在我的应用程序中,最新通知正在替换以前的通知,如何停止此行为表明所有通知都显示在通知中心,直到用户清除。

if #available(iOS 10.0, *) {
    let center  = UNUserNotificationCenter.current()
    //center.delegate = self
    center.requestAuthorization(options: [.sound, .alert, .badge]) { (granted, error) in
        if error == nil{
            UIApplication.shared.registerForRemoteNotifications()
        }
    }
} else {
    UIApplication.shared.registerUserNotificationSettings(UIUserNotificationSettings(types: [.sound, .alert, .badge], categories: nil))
    UIApplication.shared.registerForRemoteNotifications()
}
4

0 回答 0