框架——是否为新版本

- (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];
    }
    NSLog(@"key=%@,version=%@,infoDictionary=%@,saveVersion=%@,standardUserDefaults=%@",key,version,[NSBundle mainBundle].infoDictionary,saveVersion,[NSUserDefaults standardUserDefaults]);
    [self.window makeKeyAndVisible];
    return YES;
}

key=CFBundleVersion,version=1.0,infoDictionary={

    CFBundleDevelopmentRegion = en;

    CFBundleDisplayName = "\U65b0\U6d6a\U5fae\U535a";

    CFBundleExecutable = "\U65b0\U6d6a\U5fae\U535a";

    CFBundleIdentifier = "cn.itcast.----";

    CFBundleInfoDictionaryVersion = "6.0";

    CFBundleInfoPlistURL = "Info.plist -- file:///Users/dongjw/Library/Application%20Support/iPhone%20Simulator/7.1/Applications/F5E547C6-B809-4052-8C6F-CD9439D95998/%E6%96%B0%E6%B5%AA%E5%BE%AE%E5%8D%9A.app/";

    CFBundleName = "\U65b0\U6d6a\U5fae\U535a";

    CFBundleNumericVersion = 16809984;

    CFBundlePackageType = APPL;

    CFBundleShortVersionString = "1.0";

    CFBundleSignature = "????";

    CFBundleSupportedPlatforms =     (

        iPhoneSimulator

    );

    CFBundleVersion = "1.0";

    DTPlatformName = iphonesimulator;

    DTSDKName = "iphonesimulator7.1";

    LSRequiresIPhoneOS = 1;

    UIDeviceFamily =     (

        1

    );

    UIPrerenderedIcon = 1;

    UIRequiredDeviceCapabilities =     (

        armv7

    );

    UIStatusBarHidden = 1;

    UISupportedInterfaceOrientations =     (

        UIInterfaceOrientationPortrait

    );

},saveVersion=1.0,standardUserDefaults=<NSUserDefaults: 0x8f768a0>



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值