iOS Push Notification - How to get the notification data when you click on the app icon instead of notification

Howard picture Howard · Aug 23, 2012 · Viewed 17.7k times · Source

Similar to this question: How do I access remote push notification data on applicationDidBecomeActive?

But the different is how can you access the notification data when you are inapplicationDidBecomeActive and if you have clicked on the app icon instead of the push notification.

The flow is: If you click on the push notification then didReceiveRemoteNotification will be triggered, but if you click on the original app icon, only applicationDidBecomeActive will be triggered and didReceiveRemoteNotification will not be called.

I am looking for the later case so how can I access the push notification data.

(Both case assuming the app is in background and not killed yet.)

Answer

fannheyward picture fannheyward · Aug 23, 2012

You can't get remote push payload by launching app from homescreen.

If the push data is important for app use, load it from your server after app launched.