swift 获取app版本号及 ios 版本号
2016-06-13 20:40
381 查看
func versionCheck(){
let infoDictionary = NSBundle.mainBundle().infoDictionary
let appDisplayName: AnyObject? = infoDictionary!["CFBundleDisplayName"]
let majorVersion : AnyObject? = infoDictionary! ["CFBundleShortVersionString"]
let minorVersion : AnyObject? = infoDictionary! ["CFBundleVersion"]
let appversion = majorVersion as String
let iosversion : NSString =
UIDevice.currentDevice().systemVersion //ios 版本
let identifierNumber = UIDevice.currentDevice().identifierForVendor //设备 udid
let systemName = UIDevice.currentDevice().systemName //设备名称
let model = UIDevice.currentDevice().model //设备型号
let localizedModel = UIDevice.currentDevice().localizedModel //设备区域化型号 如 A1533
println(appversion)
}
let infoDictionary = NSBundle.mainBundle().infoDictionary
let appDisplayName: AnyObject? = infoDictionary!["CFBundleDisplayName"]
let majorVersion : AnyObject? = infoDictionary! ["CFBundleShortVersionString"]
let minorVersion : AnyObject? = infoDictionary! ["CFBundleVersion"]
let appversion = majorVersion as String
let iosversion : NSString =
UIDevice.currentDevice().systemVersion //ios 版本
let identifierNumber = UIDevice.currentDevice().identifierForVendor //设备 udid
let systemName = UIDevice.currentDevice().systemName //设备名称
let model = UIDevice.currentDevice().model //设备型号
let localizedModel = UIDevice.currentDevice().localizedModel //设备区域化型号 如 A1533
println(appversion)
}
majorVersion 主程序版本号 minorVersion build 版本号
相关文章推荐
- swift学习之路(十五)类的构造和析构
- tableview 最上面有空白 解决方案。
- swift 中Value Type VS Class Type
- Swift-基础-3
- Swift-基础-2
- swift学习之路(十四)类的定义
- 整理的Swift 第三库
- Swift-基础-Day1
- 在Swift项目中使用OC,在OC项目中使用Swift
- swift和oc混编
- Swift下自定义xib添加到Storyboard
- Swift下自定义xib添加到Storyboard
- 《swift踩过的坑》之“swift中使用NSClassFromString”
- iOS开发Swift篇—(十)方法
- iOS开发Swift篇—(九)属性
- iOS开发Swift篇—(八)函数(2)
- iOS开发Swift篇—(七)函数
- iOS开发Swift篇—(六)流程控制
- iOS开发Swift篇—(五)元组类型
- iOS开发Swift篇—(四)运算符