@interface AppDelegate ()
@end


@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    //1.创建窗口
    self.window = [[UIWindow alloc]init];
    self.window.frame = [UIScreen mainScreen].bounds;
    
    //2.显示窗口(成为主窗口)
    [self.window makeKeyAndVisible];
    
    //3.设置窗口根控制器
    NSString *key = (NSString *)kCFBundleVersionKey;//获取版本号的key
    NSString *version = [NSBundle mainBundle].infoDictionary[key];//当前版本号
    NSString *saveVersion = [[NSUserDefaults standardUserDefaults] objectForKey:key];//取出以前版本号
    if ([version isEqualToString: saveVersion]) {//如果相等,版本相同,不进入欢迎页面
        self.window.rootViewController = [[TabBarController alloc]init];
    }else{//如果不相等,版本不同,进入欢迎页面
         self.window.rootViewController = [[NewFeatureController alloc]init];
[[NSUserDefaults standardUserDefaults] setObject:version forKey:key];//存入沙盒中 [[NSUserDefaults standardUserDefaults] synchronize]; } }

 

以后版本升级只要修改info.plist文件里的 Bundle version 的版本号就行了.

通过版本号来判断用户是否是第一次登陆----By张秀清

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-15
  • 2022-12-23
  • 2021-12-30
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-06-06
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-19
相关资源
相似解决方案