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.
Add actions to categories
From the course: iOS and watchOS App Development: Notifications
Add actions to categories
- [Instructor] We've set our categories. Inside categories, are going to be the actions. Actions are UNNotificationAction objects, and have three parameters that we'll look at. So, let's go ahead, back to the AppDelegate, which we can do over here. AppDelegate, we set the categories, and we're going to go back up into setCategories, and above the categories we put in already, we're going to put in our actions. So the first action is nextStepAction. And then, it'll be a UNNotificationAction. And we'll use this one identifier title with options. The identifier here, is a string that identifies the action. And that's how the handler will figure out which action is which. So, you need to make sure that this is unique, and in this case, I'm just going to call it next.step. You can put next step action as well, if you would like. And, inside the next part of this, the title, that's the title of the button that's going to show up on the notification, or really, below the notification. So…
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)
Get interactive with notifications1m 39s
-
(Locked)
Configure notification categories3m 47s
-
(Locked)
Add categories to notifications2m 19s
-
(Locked)
Add actions to categories4m 37s
-
(Locked)
Respond to action requests4m 13s
-
Code the action response2m 32s
-
(Locked)
Code the next action response4m 17s
-
(Locked)
Test actions1m 47s
-
(Locked)
Text response actions2m 50s
-
(Locked)
Text response requests4m 13s
-
(Locked)
-
-
-
-
-
-
-