zoukankan      html  css  js  c++  java
  • ios判断app是否第一次使用

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
        self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
        
        
        NSString *key = (NSString *)kCFBundleVersionKey;
        
        // 1.从Info.plist中取出版本号
        NSString *version = [NSBundle mainBundle].infoDictionary[key];
        
        // 2.从沙盒中取出上次存储的版本号
        NSString *saveVersion = [[NSUserDefaults standardUserDefaults] objectForKey:key];
        
        if ([version isEqualToString:saveVersion]) { // 不是第一次使用这个版本
            // 显示状态栏
            application.statusBarHidden = NO;
            
            self.window.rootViewController = [[MainController alloc] init];
        } else { // 版本号不一样:第一次使用新版本
            // 将新版本号写入沙盒
            [[NSUserDefaults standardUserDefaults] setObject:version forKey:key];
            [[NSUserDefaults standardUserDefaults] synchronize];
            
            // 显示版本新特性界面
            self.window.rootViewController = [[NewfeatureController alloc] init];
        }
        
        [self.window makeKeyAndVisible];
        return YES;
    }
  • 相关阅读:
    分页类
    验证码扭曲类
    model 概念(笔记)
    php单例模式
    php 无限极分类查找家谱树
    数组的合并
    无限极分类之查找子孙树
    android xml中的xliff属性
    android 悬浮覆盖状态栏的相关建议
    【jzoj】20190323比赛总结
  • 原文地址:https://www.cnblogs.com/inandroid/p/3675844.html
Copyright © 2011-2022 走看看