您的位置:首页 > 移动开发 > Swift

?Swift获取手机设备信息

2015-06-01 15:55 459 查看
使用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"] as String!
// app build版本
let appBuild = info["CFBundleVersion"] as String!
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: