-
#define LAST_RUN_VERSION_KEY @"last_run_version_of_application"
-
- (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是否第一次启动
最新推荐文章于 2021-03-28 19:25:13 发布
本文转自 卓行天下 51CTO博客,原文链接:http://blog.51cto.com/9951038/1958145,如需转载请自行联系原作者