美文网首页iOS开发技能
swift获取app版本等信息

swift获取app版本等信息

作者: 舟_e9ce | 来源:发表于2019-02-26 11:28 被阅读0次
func requestCurrentVersion() {
        let infoDictionary : [String : Any] = Bundle.main.infoDictionary!
        let appName : Any = infoDictionary["CFBundleDisplayName"] // 程序名称
        let mainVersion : Any = infoDictionary["CFBundleShortVersionString"] as Any // 主程序版本号
        let minorVersion : Any = infoDictionary["CFBundleVersion"] as Any // 版本号(内部标示)
        // 设备信息
        let iosSystemVersion : NSString = UIDevice.current.systemVersion as NSString // ios版本号
        let udid = UIDevice.current.identifierForVendor // 设备udid
        let deviceName = UIDevice.current.systemName // 设备名称
        let deviceModel = UIDevice.current.model // 设备型号
        let localizedModel = UIDevice.current.localizedModel // 设备区域化型号
        let appVersion = mainVersion as! String
        print(appVersion)
    }

借鉴学习并记录一下

相关文章

网友评论

    本文标题:swift获取app版本等信息

    本文链接:https://www.haomeiwen.com/subject/xkfayqtx.html