From the course: iOS and watchOS App Development: Notifications
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Update pending notifications
From the course: iOS and watchOS App Development: Notifications
Update pending notifications
- [Instructor] With new content we can update our notification. When the user clicks the next pizza step button, the first notification with the message.pizza identifier will move to the next step. Go to the action next pizza step. Get an array of pending notifications like we did earlier. So do a UNUnserNotificationCenter.current .getPendingNotificationRequests, and then return we'll make the requests just like before. I'll iterate through the requests for the first request that has a message.pizza identifier. So it's for request in requests. Inside of that we're going to do if request.identifier .hasPrefix message.pizza. So it'll find all the identifiers that start as message.pizza. If I have a pizza to update I'll get new content from the current request. So that will be let content = self.updatePizzaContent. And a request will be request. Now I'm going to add that notification back in, and I've added to this the add notification method we used a little earlier. So we don't have to…
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.