iOS 使用 UNUserNotificationCenter 类去管理通知相关的活动
请求通知
1
2
3
4
let center = UNUserNotificationCenter.current()
center.requestAuthorization(options: [.alert, .badge, .sound]) { (result, error) in
self.showAlertDialog(title: "request notification", message: result.description)
}
获取通知状态
1
2
3
4
5
6
7