Swift获取手机设备信息
发布时间:2020-12-14 01:29:28 所属栏目:百科 来源:网络整理
导读:使用UiDevice获取设备信息: 获取设备名称 let name = UIDevice.currentDevice().name 获取设备系统名称 let systemName = UIDevice.currentDevice().systemName 获取系统版本 let systemVersion = UIDevice.currentDevice().systemVersion 获取设备模型 let
使用UiDevice获取设备信息: 获取设备名称 let name = UIDevice.currentDevice().name 获取设备系统名称 let systemName = UIDevice.currentDevice().systemName 获取系统版本 let systemVersion = UIDevice.currentDevice().systemVersion 获取设备模型 let model = UIDevice.currentDevice().model 获取设备本地模型 let localizedModel = UIDevice.currentDevice().localizedModel Swift获取Bundle的相关信息: let infoDict = NSBundle.mainBundle().infoDictionary
if let info = infoDict? { // app名称 let appName = info["CFBundleName"] as String! // app版本 let appVersion = info["CFBundleShortVersionString"] // app build版本 let appBuild = info["CFBundleVersion"] as String! }
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |