有没有一种方法可以在Swift中获取设备型号名称(iPhone 4S,iPhone 5,iPhone 5S等)?
我知道有一个名为UIDevice.currentDevice().model
的属性,但它只返回设备类型(iPod touch,iPhone,iPad,iPhone Simulator等)。
我也知道可以使用以下方法轻松地在Objective-C中完成:
#import <sys/utsname.h>
struct utsname systemInfo;
uname(&systemInfo);
NSString* deviceModel = [NSString stringWithCString:systemInfo.machine
encoding:NSUTF8StringEncoding];
但我正在使用Swift开发我的iPhone应用,所以有人可以帮我找到在Swift中解决这个问题的等效方法吗?