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.

Respond to action requests

Respond to action requests

From the course: iOS and watchOS App Development: Notifications

Start my 1-month free trial

Respond to action requests

- [Instructor] So we've got action buttons now, but they don't do anything, I can just hit them, and they just disappear, don't do anything. There's two more steps you'll need to do in order to get them to do something. First, we're going to set up another delegate method, and secondly add some code for that action. I'm going to start with the delegate. So head over to the notification center delegate, close up the app, and we're going to go to NotificationCenterDelegate.swift, and we're going to add another method to our code. So I'll put it right under the one I got already. Give myself some space, and this one's going to be userNotificationCenter, and you see the first one there is one we already have, the second one asks the delegate to process the user's response to a delivery notification, again it's hard to see this on the screen, so I'm going to go by that message on the top here to tell me which one it is. And so you get this one, which is more likely known as user…

Contents