Launch app from homescreen can't get remote push payload? But launch from Notification Center works.
At first, app is NOT running. After received remote push notification, user doesn't launch app with the notification at once. Then user taps on the notification in Notification Center to launch app, I can get the push payload from launchOptions
:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSDictionary* userInfo = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
if(userInfo) {
//do some works with push payload.
}
}
But if the user launch app by tapping app icon from homescreen, I can't get the push payload from launchOptions
, although application:didFinishLaunchingWithOptions:
is called.
Again:
- App is NOT running.
- User doesn't launch app when received push notification.
- Later, launch app from Notification Center and get push payload from launchOptions.
- Launch app from homescreen can not get push payload from launchOptions.
Is this a bug in SDK? How can I get push payload by launching app from homescreen?
Thanks!