ios开发之《版本控制》
2016-01-04 19:26
471 查看
摘要:当我们第一次使用某app或者是更新版本后打开某app时,我们会发现会由一个app简介,让我们可以了解app的一些特色功能或者说事更新之后的改进,这里就讲解一下怎么做到这样的版本控制。
在AppDelegate里面实现该功能。
在AppDelegate里面实现该功能。
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { // 创建窗口 self.window = UIWindow() self.window?.frame = UIScreen.mainScreen().bounds let versionKey: String = "CFBundleVersion" // 从沙盒中取出上次存储的软件版本号(取出用户上次的使用记录) let defaults = NSUserDefaults.standardUserDefaults() let lastVersion = defaults.objectForKey(versionKey) as? NSString // 获得当前打开软件的版本号 let currentVersion = NSBundle.mainBundle().infoDictionary![versionKey] as! NSString if(lastVersion?.isEqualToString(currentVersion as String) == true) { // 当前版本号 == 上次使用的版本号 self.window?.rootViewController = MainViewController() }else { // 当前版本号 != 上次使用的版本号 self.window?.rootViewController = NewFeatureViewController() // 存储这次使用的软件版本号 defaults.setObject(currentVersion, forKey: versionKey) // 立即存储版本号 defaults.synchronize() } return true }
相关文章推荐
- 【iOS系列】-A server with the specified hostname could not be found.问题解决
- iOS - 加解密(对称,非对称)(AES DES base64这里都有),数字签名,cookie
- IOS中把字符串加密/IOS中怎么样MD5加密/IOS中NSString分类的实现
- iOS学习笔记之故事版和音乐播放等
- iOS 通知推送APNS
- IOS 本地化
- Cordova iOS Header和Statusbar 重疊
- iOS富文本编辑(在label里显示文字和图片)
- IOS 分享你最喜欢的技巧和提示
- IOS中(Xcode) DEBUG模式(RELEASE模式)控制NSLog输出,NSLog两种不同情况的输出方式
- iOS中NSInvocation的使用
- iOS NSClassFromString
- 整理下iOS常用的三方库,以备查阅。2015年11月21日更新
- 运维监控利器Nagios之:nagios配置详解
- iOS中的label加载HTML文件
- iOS开发笔记
- iOS 中如何添加应用自己的字体
- iOS开发中常用的类库
- IOS status bar 配置方法
- ios中二维码的生成