Receive all push notifications received since the last time the app was opened.

I am creating an iOS 10 app using Xcode 8 and CloudKit. When the app loads, is there a way to read all push notifications sent since the last time the app was launched?

+3


source to share


2 answers


You can call the following function, request

contains all sent notifications



[[UNUserNotificationCenter currentNotificationCenter]
getDeliveredNotificationsWithCompletionHandler:^(NSArray<UNNotificationRequest
 _Nonnull requests) {
           NSLog(@"");
   }];

      

+2


source


from ios 10.x we can receive pending and delivered notification information using UNUserNotificationCenter

you are with a list of app notifications that are still displayed in the Notification Center using the following function



func getDeliveredNotifications (completeHandler: @escaping ([UNNotification]) → Void)

below links for more details

0


source







All Articles