Domanda

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?

È stato utile?

Soluzione

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(@" - ");
} 
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top