#define LAST_RUN_VERSION_KEY @"last_run_version_of_application"
//判断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;
}