-
(NSString*)deviceModel
{
// 需要#import "sys/utsname.h"
struct utsname systemInfo;
uname(&systemInfo);
NSString * platform = [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding];// iPhone
if ([platform isEqualToString:@"iPhone1,1"]) return @"iPhone2G";
if ([platform isEqualToString:@"iPhone1,2"]) return @"iPhone3G";
if ([platform isEqualToString:@"iPhone2,1"]) return @"iPhone3GS";
if ([platform isEqualToString:@"iPhone3,1"]) return @"iPhone4";
if ([platform isEqualToString:@"iPhone3,2"]) return @"iPhone4";
if ([platform isEqualToString:@"iPhone3,3"]) return @"iPhone4";
if ([platform isEqualToString:@"iPhone4,1"]) return @"iPhone4S";
if ([platform isEqualToString:@"iPhone5,1"]) return @"iPhone5";
if ([platform isEqualToString:@"iPhone5,2"]) return @"iPhone5";
if ([platform isEqualToString:@"iPhone5,3"]) return @"iPhone5c";
if ([platform isEqualToString:@"iPhone5,4"]) return @"iPhone5c";
if ([platform isEqualToString:@"iPhone6,1"]) return @"iPhone5s";
if ([platform isEqualToString:@"iPhone6,2"]) return @"iPhone5s";
if ([platform isEqualToString:@"iPhone7,2"]) return @"iPhone6";
if ([platform isEqualToString:@"iPhone7,1"]) return @"iPhone6Plus";
if ([platform isEqualToString:@"iPhone8,1"]) return @"iPhone6s";
if ([platform isEqualToString:@"iPhone8,2"]) return @"iPhone6sPlus";
if ([platform isEqualToString:@"iPhone8,3"]) return @"iPhoneSE";
if ([platform isEqualToString:@"iPhone8,4"]) return @"iPhoneSE";
if ([platform isEqualToString:@"iPhone9,1"]) return @"iPhone7";
if ([platform isEqualToString:@"iPhone9,2"]) return @"iPhone7Plus";
if ([platform isEqualToString:@"iPhone9,3"]) return @"iPhone7";
if ([platform isEqualToString:@"iPhone9,4"]) return @"iPhone7Plus";
if ([platform isEqualToString:@"iPhone10,1"]) return @"iPhone 8";
if ([platform isEqualToString:@"iPhone10,4"]) return @"iPhone 8";
if ([platform isEqualToString:@"iPhone10,2"]) return @"iPhone 8 Plus";
if ([platform isEqualToString:@"iPhone10,5"]) return @"iPhone 8 Plus";
if ([platform isEqualToString:@"iPhone10,3"]) return @"iPhone X";
if ([platform isEqualToString:@"iPhone10,6"]) return @"iPhone X";//iPod Touch
if ([platform isEqualToString:@"iPod1,1"]) return @"iPod Touch";
if ([platform isEqualToString:@"iPod2,1"]) return @"iPod Touch2G";
if ([platform isEqualToString:@"iPod3,1"]) return @"iPod Touch3G";
if ([platform isEqualToString:@"iPod4,1"]) return @"iPod Touch4G";
if ([platform isEqualToString:@"iPod5,1"]) return @"iPod Touch5G";
if ([platform isEqualToString:@"iPod7,1"]) return @"iPod Touch6G";//iPad
if ([platform isEqualToString:@"iPad1,1"]) return @"iPad";
if ([platform isEqualToString:@"iPad2,1"]) return @"iPad2";
if ([platform isEqualToString:@"iPad2,2"]) return @"iPad2";
if ([platform isEqualToString:@"iPad2,3"]) return @"iPad2";
if ([platform isEqualToString:@"iPad2,4"]) return @"iPad2";
if ([platform isEqualToString:@"iPad3,1"]) return @"iPad3";
if ([platform isEqualToString:@"iPad3,2"]) return @"iPad3";
if ([platform isEqualToString:@"iPad3,3"]) return @"iPad3";
if ([platform isEqualToString:@"iPad3,4"]) return @"iPad4";
if ([platform isEqualToString:@"iPad3,5"]) return @"iPad4";
if ([platform isEqualToString:@"iPad3,6"]) return @"iPad4";
if ([platform isEqualToString:@"iPad6,11"]) return @"iPad(9.7)";
if ([platform isEqualToString:@"iPad6,12"]) return @"iPad(9.7)";//iPad Air
if ([platform isEqualToString:@"iPad4,1"]) return @"iPadAir";
if ([platform isEqualToString:@"iPad4,2"]) return @"iPadAir";
if ([platform isEqualToString:@"iPad4,3"]) return @"iPadAir";
if ([platform isEqualToString:@"iPad5,3"]) return @"iPadAir2";
if ([platform isEqualToString:@"iPad5,4"]) return @"iPadAir2";//iPad mini
if ([platform isEqualToString:@"iPad2,5"]) return @"iPad mini1G";
if ([platform isEqualToString:@"iPad2,6"]) return @"iPad mini1G";
if ([platform isEqualToString:@"iPad2,7"]) return @"iPad mini1G";
if ([platform isEqualToString:@"iPad4,4"]) return @"iPad mini2";
if ([platform isEqualToString:@"iPad4,5"]) return @"iPad mini2";
if ([platform isEqualToString:@"iPad4,6"]) return @"iPad mini2";
if ([platform isEqualToString:@"iPad4,7"]) return @"iPad mini3";
if ([platform isEqualToString:@"iPad4,8"]) return @"iPad mini3";
if ([platform isEqualToString:@"iPad4,9"]) return @"iPad mini3";
if ([platform isEqualToString:@"iPad5,1"]) return @"iPad mini4";
if ([platform isEqualToString:@"iPad5,2"]) return @"iPad mini4";//iPad Pro
if ([platform isEqualToString:@"iPad6,3"]) return @"iPad Pro(9.7)";
if ([platform isEqualToString:@"iPad6,4"]) return @"iPad Pro(9.7)";
if ([platform isEqualToString:@"iPad6,7"]) return @"iPad Pro(12.9)";
if ([platform isEqualToString:@"iPad6,8"]) return @"iPad Pro(12.9)";
if ([platform isEqualToString:@"iPad7,1"]) return @"iPad Pro2(12.9)";
if ([platform isEqualToString:@"iPad7,2"]) return @"iPad Pro2(12.9)";
if ([platform isEqualToString:@"iPad7,3"]) return @"iPad Pro2(10.5)";
if ([platform isEqualToString:@"iPad7,4"]) return @"iPad Pro2(10.5)";if ([platform isEqualToString:@"i386"]) return @"iPhoneSimulator";
if ([platform isEqualToString:@"x86_64"]) return @"iPhoneSimulator";return platform;
}
ios史上最全的获取手机型号方法
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- iOS获取设备型号和App版本号等信息(OC+Swift) 获取设备名称OC代码 NSString *device...
- #include #include //获得设备型号 + (NSString *)getCurrentDevice...