您的位置:首页 > 移动开发 > Swift

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)

    }
majorVersion  主程序版本号

minorVersion  build 版本号


内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: