判断APP的启动方式


#pragma mark -┏━━━━━━━━━━━━━━━━启动APP的方式━━━━━━━━━━━━━━━━━┓

    if (launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey]) {
#pragma mark - 1.远程通知 launch app
        NSLog(@"%@",launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey]);
    }else if (launchOptions[UIApplicationLaunchOptionsURLKey]&&launchOptions[UIApplicationOpenURLOptionsSourceApplicationKey]){
#pragma mark - 2.其他应用 launch app
        NSLog(@"%@\n%@",launchOptions[UIApplicationLaunchOptionsURLKey],launchOptions[UIApplicationOpenURLOptionsSourceApplicationKey]);
    }else if (launchOptions[UIApplicationLaunchOptionsLocalNotificationKey]){
#pragma mark - 3.本地通知 launch app
        NSLog(@"%@",launchOptions[UIApplicationLaunchOptionsLocalNotificationKey]);
    }else if(!launchOptions){
#pragma mark - 4.点击Icon launch app
        NSLog(@"点击Icon启动");
    }else{}

#pragma mark -┗━━━━━━━━━━━━━━━━启动APP的方式━━━━━━━━━━━━━━━━━┛

你可能感兴趣的:(判断APP的启动方式)