iOS 判断APP是否是第一次启动

//判断第一次 登陆

- (BOOL)isFirstLoad{

NSString *currentVersion = [[[NSBundle mainBundle] infoDictionary]

objectForKey:@"CFBundleShortVersionString"];

NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];

NSString *lastRunVersion = [defaults objectForKey:LAST_RUN_VERSION_KEY];

if (!lastRunVersion) {

[defaults setObject:currentVersion forKey:LAST_RUN_VERSION_KEY];

return YES;

}

else if (![lastRunVersion isEqualToString:currentVersion]) {

[defaults setObject:currentVersion forKey:LAST_RUN_VERSION_KEY];

return YES;

}

return NO;

}

你可能感兴趣的:(iOS 判断APP是否是第一次启动)