Hello to all I'm stuck with one issue in my iOS app. I have searched over the internet and didn't find solution. Most of the solutions are using deprecated
func application(_ application: UIApplication, didReceive notification: UILocalNotification)
So scenario is following:
App schedules for each day 5 local notifications and that is okay and that works:
var dateComponents = DateComponents()
dateComponents.weekday = Date().dayNumberOfWeek()
dateComponents.hour = hour
dateComponents.minute = minute
dateComponents.second = 5
let notificationTrigger = UNCalendarNotificationTrigger(dateMatching: dateComponents, repeats: false)
let request = UNNotificationRequest(identifier: "identifier", content: notifcation, trigger: notificationTrigger)
UNUserNotificationCenter.current().add(request, withCompletionHandler: nil)
But my question is: is it possible to find out when notification is fired regardless of app state and get data from that notification?
Because time for each notification is retrieved from API I don't know when (hour and minute) notifications will be scheduled.
For example in Android I schedule notifications using AlarmManager API and than easly by extending BroadcastReciver I can fetch every fired notification and get data sent via Intent.
I need to find out when last (fifth) notification is fired for that day so I can preform some additional work.