My app allows users to set a number of reminders in the future. When the app lauches I want to know what reminders (notifications) have already been set.
Can I read back the notifications I have set or do I need to store in my app (e.g. Core Data or Plist)?
But in iOS we can't schedule more than 64 notifications at a time.
Local notifications are scheduled by an app and delivered on the same device. They are suited for apps with time-based behaviors, such as calendar events. When you run your app on a device with Android OS 8.0 or above, Kony uses default channels that are mentioned in the localnotificationconfig.
Expected Behavior. The local notification should occur at the schedule time even if the app is closed.
UIApplication
has a property called scheduledLocalNotifications
which returns an optional array containing elements of type UILocalNotification
.
UIApplication.shared.scheduledLocalNotifications
For Swift 3.0 and Swift 4.0
don't forget to do import UserNotifications
This is working for iOS10+ and watchOS3+ since the class UNUserNotificationCenter is not available for older versions (link)
let center = UNUserNotificationCenter.current() override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) center.getPendingNotificationRequests { (notifications) in print("Count: \(notifications.count)") for item in notifications { print(item.content) } } }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With