device

How to determine the current iPhone/device model?

本小妞迷上赌 提交于 2019-11-25 21:52:00
问题 Is there a way to get the device model name (iPhone 4S, iPhone 5, iPhone 5S, etc) in Swift? I know there is a property named UIDevice.currentDevice().model but it only returns device type (iPod touch, iPhone, iPad, iPhone Simulator, etc). I also know it can be done easily in Objective-C with this method: #import <sys/utsname.h> struct utsname systemInfo; uname(&systemInfo); NSString* deviceModel = [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding]; But I\'m