class func getDeviceInfo() -> (model: String) {
if let bundlePath = Bundle.main.path(forResource: "DeviceInfo", ofType: "plist") {
let dicData = NSDictionary(contentsOfFile: bundlePath) as! Dictionary<String, Any>
var systemInfo = utsname()
uname(&systemInfo)
let platform = withUnsafePointer(to: &systemInfo.machine.0) { ptr in
return String(cString: ptr)
}
guard let plat = dicData[platform] else {
return ("iPhone")
}
return (plat as! String)
}
return ("iPhone")
}
网友评论