I have to locally store Title and Body of all the notifications coming in my iOS app and display those in a notifications screen. I'm able to store all the notification tapped by using these-
This gets called when the app is in not running state or killed when the push notification is tapped-
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {...}
This gets called when app is running in foreground or background and push notification is tapped-
func userNotificationCenter(_ center: UNUserNotificationCenter,
didReceive response: UNNotificationResponse,
withCompletionHandler completionHandler: @escaping () -> Void) {...}
My question is how to store notifications without tapping on notifications. I want to store the notifications even if the notification is dimissed/cleared by user.
I know this method is called when app is active and in the foreground and push notification comes-
func userNotificationCenter(_ center: UNUserNotificationCenter,
willPresent notification: UNNotification,
withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {..}
How to handle push notification data without tapping on it when the app is in background or not running state?