From the course: iOS and watchOS App Development: Notifications
Unlock the full course today
Join today to access over 22,500 courses taught by industry experts or purchase this course individually.
Update notification content
From the course: iOS and watchOS App Development: Notifications
Update notification content
- [Instructor] Data might change while a request is still pending. To best serve your user, you'll need to update the content. Let's look at how to update content of a pending notification. You'll need to get the notification, then update its content. Delivered and pending notifications return a content object, UNNotificationContent, which is read only, so we'll have to replace the content. I'll set this up to change the content in a notification with a step for making pizzas. Stop the app and head back to View Controller, and head to the top. You'll see I made a global constant of pizza steps, and what we're going to do is change the pizza step by pushing a button in the manage notification View Controller. So, going back to Manage Notification View Controller, and just underneath where it says nextPizzaStep, which is the one we're going to be using, give yourself some space and add the following function, func updatePizzaContent. That will be a request of UNNotificationRequest, and…
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.
Contents
-
-
-
-
-
(Locked)
Pending notifications3m 57s
-
Unique identifiers3m 41s
-
(Locked)
Delivered notifications4m 7s
-
(Locked)
Update notification content5m 45s
-
(Locked)
Update pending notifications4m 5s
-
(Locked)
Remove notifications3m 55s
-
(Locked)
Repeating notifications5m 31s
-
(Locked)
Remove all notifications2m 23s
-
(Locked)
Custom group notifications4m 59s
-
(Locked)
-
-
-
-
-
-
-
-