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.

User info in app

User info in app

From the course: iOS and watchOS App Development: Notifications

Start my 1-month free trial

User info in app

- [Instructor] Now that you have our handy method for inserting user info, let's see it in action. You're going to stick this into the snooze response, so the snoozed local notification shows the order. The code, as I wrote it, only changes the body text if there's a valid array in user info with the key. If not, it won't change anything. So let's head up to the user notification center, did receive response, and then you'll find the snooze action method, there's action is canceled, snooze, and then above the trigger here I'm going to add let content equals changePizzaNotification and my content will be the request.content, and then I'll change the snoozes request to change the content. So down here, it's not going to be request.content, here it's going to be content. All right, with that in place go ahead and run the code. Once you do that go ahead and copy and paste the payload into the platform if you haven't done so, and send the notification. I'll show you this on a live phone…

Contents