- - (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;
- }
- (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>