From the course: iOS and watchOS App Development: Notifications
Unlock the full course today
Join today to access over 22,400 courses taught by industry experts or purchase this course individually.
Delivered notifications
From the course: iOS and watchOS App Development: Notifications
Delivered notifications
- [Instructor] If you wait long enough and then hit the view pending notifications, you'll see that all the notifications are gone again. Once a notification displays, it is a delivered notification. It stays a delivered notification until the user interacts with a notification. You can obtain an array of delivered notifications using the method get delivered notifications. The method has a closure with a parameter of an array of notifications. Go ahead and stop the app again and find the view delivered pizzas action in the managed notification controller. We'll make this action send the delivered notifications to the console. So add the method, UNUserNotificationCenter.current.get delivered notifications, and there's the delivered one. Again, it has a completion handler with a parameter. I'm going to go ahead and hit return there, and for this one, we got a UN notification number request this time. And so we're going to call this notifications. And then we have the code. And just…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.