iOS - 判断是否第一次登陆APP

时间:2021-08-27 16:11:28

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

    // Override point for customization after application launch.

    

    

    if (![[NSUserDefaults standardUserDefaults]boolForKey:@"firstLaunch"]) {


        NSLog(@"first time to launch ");

        [[NSUserDefaults standardUserDefaults]setBool:YES forKey:@"firstLaunch"];

        [[NSUserDefaults standardUserDefaults]setBool:NO forKey:@"everLaunch"];



    }else {


        NSLog(@"ever launched ");

        [[NSUserDefaults standardUserDefaults]setBool:YES forKey:@"everLaunch"];



    }

    

    return YES;

}



    }