首页 > 代码库 > swift 获取app版本号及 ios 版本号

swift 获取app版本号及 ios 版本号

swift 获取app版本号及 ios 版本号

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 版本号
 

swift 获取app版本号及 ios 版本号