Reputation: 1021
I'm creating an iOS 10 app using Xcode 8 and CloudKit. When the app loads, is there any way to read all push notification that have been sent since the last time the app was running?
Upvotes: 8
Views: 3533
Reputation: 524
You can call the following function, request
contains all notifications delivered
[[UNUserNotificationCenter currentNotificationCenter]
getDeliveredNotificationsWithCompletionHandler:^(NSArray<UNNotificationRequest
_Nonnull requests) {
NSLog(@"");
}];
Upvotes: 7
Reputation: 726
from ios 10.x we can get pending and delivered notification information using UNUserNotificationCenter
you with a list of the app’s notifications that are still displayed in Notification Center using below function
func getDeliveredNotifications(completionHandler: @escaping ([UNNotification]) -> Void)
refrer below link for more details
Upvotes: 1