【发布时间】:2021-04-22 02:25:34
【问题描述】:
注册远程通知 对于 iOS 12 或更高版本的显示通知(通过 APNS 发送) 我只需要添加下面的代码,对吧?
let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound]
UNUserNotificationCenter.current().requestAuthorization(
options: authOptions,
completionHandler: {_, _ in })
application.registerForRemoteNotifications()
不需要像 iOS 10 的示例那样的 if-else: https://github.com/firebase/quickstart-ios/blob/365e43642f2cc570df004cb16e098a76cde1e5b1/messaging/MessagingExampleSwift/AppDelegate.swift#L40-L55
【问题讨论】:
标签: ios swift firebase-cloud-messaging apple-push-notifications remote-notifications