If app is not in background, push notification came. Clicking on launch button will not show push notification, it will just open app, for opening of that push notification we have to tap again on push notification from notification tray. Any way with launch we can show notification also?

有帮助吗?

解决方案

This is resolved. Answer was:

(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    

NSDictionary *tmpDic = [launchOptions objectForKey:@"UIApplicationLaunchOptionsRemoteNotificationKey"];

//if tmpDic is not nil, then your app is launched due to an APNs push, therefore check this NSDictionary for further information
if (tmpDic != nil) {
    NSLog(@" - launch options dict has something ");
    NSLog(@" - badge number is %@ ", [[tmpDic objectForKey:@"aps"] objectForKey:@"badge"]);
    NSLog(@" - ");
} 
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top