Pra*_*rav 28 xcode apple-push-notifications swift ios10 xcode8
我正在寻找在iOS 10中实现UIUserNotificationSettings的替代方法.
Apple文档提供了以下框架以供进一步使用.UNNotificationSettings链接在这里.
是否有人可以帮助我使用示例代码来使用UNNotificationSettings而不是UIUserNotificationSettings来实现下面的代码
let notificationSettings = UIUserNotificationSettings(
forTypes: [.Badge, .Sound, .Alert], categories: nil)
application.registerUserNotificationSettings(notificationSettings)
Run Code Online (Sandbox Code Playgroud)
Ole*_*huk 57
注册通知您应该实现此代码:
import UserNotifications
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound, .badge]) {
(granted, error) in
//Parse errors and track state
}
Run Code Online (Sandbox Code Playgroud)
此资源包含其他信息.
| 归档时间: |
|
| 查看次数: |
22104 次 |
| 最近记录: |