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 user info in payload
From the course: iOS and watchOS App Development: Notifications
Add user info in payload
- [Instructor] So far, you've added everything to the APS Dictionary in the payload. APNS does not restrict you to these few content objects. In this lesson, we'll discuss the user info content for custom content. So let's go back over Xcode, and we can get rid of that for now. And in the Payload Editor, if you place things outside the APS Dictionary, they're collected in the User Info Dictionary of the notification content. So, for example, if I do it outside here, which is the outside of the APS, I'm going to go ahead and add a list for my ordering an array. So I can do quote order colon, and then, I'm going to make an array, Huli Pizza, L-I-L-I, Lilikoi punch and Duke Pie. I'm going to make this the body text of my snooze notification. Much of this should look familiar. Head back over to NotificationCenterDelegate and put this above the Support Methods mark. Func changePizzaNotification content, and I'm going to make that oldContent, which is a UNNotificationContent, and that is…
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.