swift 获取设备信息,app信息

本文介绍了如何使用Swift语言从iOS设备上获取应用程序的各种信息,包括版本号、名称、Build号、Bundle ID等,同时也提供了获取设备信息的方法,例如系统名称、版本、UDID、名称、型号等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >


//获取app信息
let infoDictionary: Dictionary = Bundle.main.infoDictionary!

// 当前版本号
let kAppCurrentVersion = infoDictionary["CFBundleShortVersionString"] as! String

// app名称
let kAppDisplayName = infoDictionary["CFBundleDisplayName"] as! String

// build号
let kAppMinorVersion = infoDictionary["CFBundleVersion"] as! String

// bundleId
let kBundleId: String = Bundle.main.bundleIdentifier ?? ""

// 系统名称,如:iOS
let kSystemName: String = UIDevice.current.systemName

// 系统版本,如:14.6
let kSystemVersion: String = UIDevice.current.systemVersion

// 设备udid
//let kUdid = UIDevice.current.identifierForVendor!.uuidString

// 设备名称,这个是用户可以自己定义的。如:xxx的iphoneX
let kDeviceName: String = UIDevice.current.name

// 设备型号,具体是什么手机。如:iPhone13
// modelName查看https://blog.csdn.net/HDFQQ188816190/article/details/123742637?spm=1001.2014.3001.5501
let kPhoneModel: String = UIDevice.current.modelName

// 设备型号, 如:iphone
let kDeviceModel = UIDevice.current.model

// 设备区域化型号,如:A1533
let kLocalizedModel = UIDevice.current.localizedModel

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值