所有这些都来自我当前正在开发的一个应用程序,我们将此应用程序称为SampleApp
如何从手机托盘中获得这些通知的列表
是的,我确实知道我可以通过此代码获得通知
if #available(iOS 10.0, *) {
UNUserNotificationCenter.current().getPendingNotificationRequests { (requests) in
print("here are the iOS 10 notifs \(requests)")
}
} else {
let requests = (UIApplication.shared.scheduledLocalNotifications ?? [])
print("here are the NON iOS 10 notifs \(requests)")
}
但是此代码的问题在于,我只能获取我离线创建]的通知,而不能接收来自Apple Push Notification Server(APNS)的通知”>
我是指离线创建,是预定的UILocalNotification
,并且由于Push Notifications不是UILocalNotification
,所以我不知道该怎么办
您可能会问的一些问题
是从我的应用发出的这些通知吗?
我是在didReceiveRemoteNotification
上使用AppDelegate
吗?
我的远程通知是否可以从APNS工作/收到通知
我的注册远程通知的代码是什么样的?
if #available(iOS 10.0, *) {
let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound]
let center = UNUserNotificationCenter.current()
center.delegate = self
center.requestAuthorization(options: authOptions, completionHandler: { (_, _) in })
} else {
let settings = UIUserNotificationSettings(types: [.alert, .badge, .sound], categories: nil)
application.registerUserNotificationSettings(settings)
}
application.registerForRemoteNotifications()
所有这些都来自我当前正在开发的一个应用程序,我们将此应用程序称为SampleApp如何从手机托盘中获取这些通知的列表,是的,我确实知道我可以获取...
Dávid Pásztor的评论部分解决了该问题,因为现在我可以检索Notification Center
中显示的all