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

Add actions to categories

From the course: iOS and watchOS App Development: Notifications

Start my 1-month free trial

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…

Contents