How to detect Remote notification in didFinishLaunchingWithOption application method in objective c?

后端 未结 4 1436
予麋鹿
予麋鹿 2021-01-28 22:34

when app in not in background mode ,inactive mode and app is completely closed. than how to detect is their any notification using application\'s delegate \"didFinishLaunchingWi

4条回答
  •  说谎
    说谎 (楼主)
    2021-01-28 23:14

    You can get Notification in the didFinishLaunchingWithOption in this way :

    (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
    
      NSDictionary *notification = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
         if (notification) {
              NSLog(@"app recieved notification from remote%@",notification);
       }else{
            NSLog(@"app did not recieve notification");
       }
    }
    

    Try this it may help you.

提交回复
热议问题