zoukankan      html  css  js  c++  java
  • 通过版本号来判断用户是否是第一次登陆----By张秀清

    @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 的版本号就行了.

     
  • 相关阅读:
    MySQL 对于千万级的大表要怎么优化?
    Spring Cloud中文社区
    什么是QPS,PV
    http://www.rabbitmq.com/documentation.html
    redis
    MySQL分区表
    linux命令综合
    Python-MRO
    Python3 错误和异常
    装饰器
  • 原文地址:https://www.cnblogs.com/sixindev/p/4465981.html
Copyright © 2011-2022 走看看