常用的的几个判断如下:
//设备名称
return [UIDevice currentDevice].name;
//设备型号,只可得到是何设备,无法得到是第几代设备
return [UIDevice currentDevice].model;
//系统版本型号,如iPhone OS
return [UIDevice currentDevice].systemVersion;
//系统版本名称,如6.1.3
return [UIDevice currentDevice].systemName;
(缺点就是只能判断是iPad或是iPhone)
以下方法可获取详细的设备型号:
//设备型号
+(NSString*)getDeviceType{
//需要导入 "sys/utsname.h"
struct utsname systemInfo;
uname(&systemInfo);
//get the device model and the system version
NSString *deviceString=[NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding];
//iPhone
if ([deviceString isEqualToString:@&#