UIUserNotificationSettings 在 iOS 10 中弃用
UIUserNotificationSettings deprecated in iOS 10
我正在寻找在 iOS 10 中实现 UIUserNotificationSettings 的替代方法。
Apple 文档提供了以下框架供进一步使用。 link here.
中的 UNNotificationSettings
有没有人可以帮助我使用示例代码来使用 UNNotificationSettings 而不是 UIUserNotificationSettings 来实现以下内容
let notificationSettings = UIUserNotificationSettings(
forTypes: [.Badge, .Sound, .Alert], categories: nil)
application.registerUserNotificationSettings(notificationSettings)
注册通知你应该执行这段代码:
import UserNotifications
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound, .badge]) {
(granted, error) in
//Parse errors and track state
}
此 resource 包含更多信息。
我正在寻找在 iOS 10 中实现 UIUserNotificationSettings 的替代方法。
Apple 文档提供了以下框架供进一步使用。 link here.
中的 UNNotificationSettings有没有人可以帮助我使用示例代码来使用 UNNotificationSettings 而不是 UIUserNotificationSettings 来实现以下内容
let notificationSettings = UIUserNotificationSettings(
forTypes: [.Badge, .Sound, .Alert], categories: nil)
application.registerUserNotificationSettings(notificationSettings)
注册通知你应该执行这段代码:
import UserNotifications
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound, .badge]) {
(granted, error) in
//Parse errors and track state
}
此 resource 包含更多信息。