判断软件是不是第一次启动

 在打开一个软件的时候我们都要有一个简单地引导页面或者欢迎界面,引导页面可以帮助用户清楚的了解出软件的使用,提高用户对软件的感观。

在AppDelegate.m文件中 

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

NSString *key = @"CFBundleVersion";

// 取出沙盒中存储的上次使用软件的版本号
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSString *lastVersion = [defaults stringForKey:key];

// 获得当前软件的版本号
NSString *currentVersion = [NSBundle mainBundle].infoDictionary[key];

if ([currentVersion isEqualToString:lastVersion]) {
// 显示状态栏,旧版本不显示新特性
application.statusBarHidden = NO;

self.window.rootViewController = [[IWTabBarViewController alloc] init];
} else { // 新版本 显示新特新
self.window.rootViewController = [[IWNewfeatureViewController alloc] init];
// 存储新版本
[defaults setObject:currentVersion forKey:key];
[defaults synchronize];
}
[self.window makeKeyAndVisible];
return YES;

握不住的沙,干脆扬了它。
原文地址:https://www.cnblogs.com/zj901203/p/4389950.html