I receive my push notification successfully but when I tap on it, it simply takes me to first view when my app loads.
I want the user to go to specific views depending on the push notification because the user will be receiving many different push notifications (1 for each soccer team, hence possiblity of many different views).
So example: I have a view controller called manchesterUnitedView and somebody just scored so the user receives a push notification for that particular view. When they press it, I want it to take them to the manchesterUnitedView.
Does anyone know how to do this?
thanks
You can use the payload of the notification to pass the information you need to the app, then retrieve it and use it when the app is launched as a result of the user tapping on a notification.
To do this just add a custom dictionary to the JSON payload of the notification and add the information you need to pass to the app there.
See here for details on the payload format.
You can then retrieve your custom dictionary when the app is launched in the application:didFinishLaunchingWithOptions:
method implementation of your UIApplicationDelegate
and use it to initialize your application state.
See here for documentation of how to retrieve the payload in your UIApplicationDelegate.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With