문제

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