如何查看UNUserNotificationCenter以获取iOS 11中的当前授权状态?我一直在寻找一段时间并找到一些代码,但它不是在
swift 3中,而且一些功能在iOS 10中被弃用了.任何人都可以帮忙吗?
好的,我找到了:
let center = UNUserNotificationCenter.current() center.getNotificationSettings { (settings) in if(settings.authorizationStatus == .authorized) { print("Push authorized") } else { print("Push not authorized") } }
代码:Kuba