获取应用名称、应用版本、设备型号、系统版本等信息

import UIKit

class ViewController: UIViewController {

override func viewDidLoad() {
    super.viewDidLoad()
     
    //应用程序信息
    let infoDictionary = Bundle.main.infoDictionary!
    let appDisplayName = infoDictionary["CFBundleDisplayName"] //程序名称
    let majorVersion = infoDictionary["CFBundleShortVersionString"]//主程序版本号
    let minorVersion = infoDictionary["CFBundleVersion"]//版本号(内部标示)
    let appVersion = majorVersion as! String
     
    //设备信息
    let iosVersion = UIDevice.current.systemVersion //iOS版本
    let identifierNumber = UIDevice.current.identifierForVendor //设备udid
    let systemName = UIDevice.current.systemName //设备名称
    let model = UIDevice.current.model //设备型号
    let modelName = UIDevice.current.modelName //设备具体型号
    let localizedModel = UIDevice.current.localizedModel //设备区域化型号如A1533
     
    //打印信息
    print("程序名称:\(appDisplayName)")
    print("主程序版本号:\(appVersion)")
    print("内部版本号:\(minorVersion)")
    print("iOS版本:\(iosVersion)")
    print("设备udid:\(identifierNumber)")
    print("设备名称:\(systemName)")
    print("设备型号:\(model)")
    print("设备具体型号:\(modelName)")
    print("设备区域化型号:\(localizedModel)")
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
}

}
原文链接:https://blog.csdn.net/mo_xiao_mo/article/details/72841003

你可能感兴趣的:(获取应用名称、应用版本、设备型号、系统版本等信息)