Group Group Group Group Group Group Group Group Group

Chapter 8: Handling common Scenarios

#1

when setting the userInfo payload I dont get presented with the viewcontroller I specified. It still just goes to the startup storyboard. What do I need to do to make this work? I skipped chapter 6 and am just using the push notifications app you suggested.

0 Likes

#2

@gargoyle Can you please help with this when you get a chance? Thank you - much appreciated! :]

0 Likes

#3

@jessemfulton There’s nothing in the payload of a push notification that will tell iOS what controller should be loaded. If you’re using the payload to open a specific controller, then your startup method, whichever is appropriate for the type of push notification you’re sending, is going to have to explicitly load and display that view controller.

0 Likes

#4

Thanks gargoyle. What I am looking for is in my app I pull in articles and videos through an api. When a new article is pulled in I want to send a notification to the user with the articles title and when they click on it it goes to the article. The notifications are set up, but when they click on the notification it just sends the user to the apps main view controller. When I followed the push notifications tutorial you briefly talk about this, but there isn’t very mush info on how to do this except for utilizing payload. If I am doing this incorrectly can you point me to the correct location of where to learn how to do this?

Thanks

0 Likes

#5

At the end of page 92 in the book I start showing the example of how to do this. Have you replicated that code? I know this seems obvious but are you sure the name attached to the view controller in the storyboard matches what you’re passing as the identifier on instantiateViewController(withIdentifier:)?

0 Likes