ios,设备标签与设备型号的对应关系(包含6plus)
2015-04-17 14:29
232 查看
今天遇到一款6plus的设备[UIScreen mainScreen].bounds.size.height打印出来是667,我表示还是比较吃惊的,然后就通过设备型号来判断手机到底是6plus还是其他的手机:
结果打印出得string与型号之间的对应信息:
@"i386" on 32-bit Simulator
@"x86_64" on 64-bit Simulator
@"iPod1,1" on iPod Touch
@"iPod2,1" on iPod Touch Second Generation
@"iPod3,1" on iPod Touch Third Generation
@"iPod4,1" on iPod Touch Fourth Generation
@"iPhone1,1" on iPhone
@"iPhone1,2" on iPhone 3G
@"iPhone2,1" on iPhone 3GS
@"iPad1,1" on iPad
@"iPad2,1" on iPad 2
@"iPad3,1" on 3rd Generation iPad
@"iPhone3,1" on iPhone 4 (GSM)
@"iPhone3,3" on iPhone 4 (CDMA/Verizon/Sprint)
@"iPhone4,1" on iPhone 4S
@"iPhone5,1" on iPhone 5 (model A1428, AT&T/Canada)
@"iPhone5,2" on iPhone 5 (model A1429, everything else)
@"iPad3,4" on 4th Generation iPad
@"iPad2,5" on iPad Mini
@"iPhone5,3" on iPhone 5c (model A1456, A1532 | GSM)
@"iPhone5,4" on iPhone 5c (model A1507, A1516, A1526 (China), A1529 | Global)
@"iPhone6,1" on iPhone 5s (model A1433, A1533 | GSM)
@"iPhone6,2" on iPhone 5s (model A1457, A1518, A1528 (China), A1530 | Global)
@"iPad4,1" on 5th Generation iPad (iPad Air) - Wifi
@"iPad4,2" on 5th Generation iPad (iPad Air) - Cellular
@"iPad4,4" on 2nd Generation iPad Mini - Wifi
@"iPad4,5" on 2nd Generation iPad Mini - Cellular
@"iPhone7,1" on iPhone 6 Plus
@"iPhone7,2" on iPhone 6
转自:
http://stackoverflow.com/questions/11197509/ios-how-to-get-device-make-and-model
#import <sys/utsname.h> // import it in your header or implementation file. NSString* deviceName() { struct utsname systemInfo; uname(&systemInfo); return [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding]; }
结果打印出得string与型号之间的对应信息:
@"i386" on 32-bit Simulator
@"x86_64" on 64-bit Simulator
@"iPod1,1" on iPod Touch
@"iPod2,1" on iPod Touch Second Generation
@"iPod3,1" on iPod Touch Third Generation
@"iPod4,1" on iPod Touch Fourth Generation
@"iPhone1,1" on iPhone
@"iPhone1,2" on iPhone 3G
@"iPhone2,1" on iPhone 3GS
@"iPad1,1" on iPad
@"iPad2,1" on iPad 2
@"iPad3,1" on 3rd Generation iPad
@"iPhone3,1" on iPhone 4 (GSM)
@"iPhone3,3" on iPhone 4 (CDMA/Verizon/Sprint)
@"iPhone4,1" on iPhone 4S
@"iPhone5,1" on iPhone 5 (model A1428, AT&T/Canada)
@"iPhone5,2" on iPhone 5 (model A1429, everything else)
@"iPad3,4" on 4th Generation iPad
@"iPad2,5" on iPad Mini
@"iPhone5,3" on iPhone 5c (model A1456, A1532 | GSM)
@"iPhone5,4" on iPhone 5c (model A1507, A1516, A1526 (China), A1529 | Global)
@"iPhone6,1" on iPhone 5s (model A1433, A1533 | GSM)
@"iPhone6,2" on iPhone 5s (model A1457, A1518, A1528 (China), A1530 | Global)
@"iPad4,1" on 5th Generation iPad (iPad Air) - Wifi
@"iPad4,2" on 5th Generation iPad (iPad Air) - Cellular
@"iPad4,4" on 2nd Generation iPad Mini - Wifi
@"iPad4,5" on 2nd Generation iPad Mini - Cellular
@"iPhone7,1" on iPhone 6 Plus
@"iPhone7,2" on iPhone 6
#import <sys/utsname.h> #import "MyClass.h" @implementation MyClass { //(your private ivars) } - (NSString*) deviceName { struct utsname systemInfo; uname(&systemInfo); NSString* code = [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding]; static NSDictionary* deviceNamesByCode = nil; if (!deviceNamesByCode) { deviceNamesByCode = @{@"i386" :@"Simulator", @"iPod1,1" :@"iPod Touch", // (Original) @"iPod2,1" :@"iPod Touch", // (Second Generation) @"iPod3,1" :@"iPod Touch", // (Third Generation) @"iPod4,1" :@"iPod Touch", // (Fourth Generation) @"iPhone1,1" :@"iPhone", // (Original) @"iPhone1,2" :@"iPhone", // (3G) @"iPhone2,1" :@"iPhone", // (3GS) @"iPad1,1" :@"iPad", // (Original) @"iPad2,1" :@"iPad 2", // @"iPad3,1" :@"iPad", // (3rd Generation) @"iPhone3,1" :@"iPhone 4", // (GSM) @"iPhone3,3" :@"iPhone 4", // (CDMA/Verizon/Sprint) @"iPhone4,1" :@"iPhone 4S", // @"iPhone5,1" :@"iPhone 5", // (model A1428, AT&T/Canada) @"iPhone5,2" :@"iPhone 5", // (model A1429, everything else) @"iPad3,4" :@"iPad", // (4th Generation) @"iPad2,5" :@"iPad Mini", // (Original) @"iPhone5,3" :@"iPhone 5c", // (model A1456, A1532 | GSM) @"iPhone5,4" :@"iPhone 5c", // (model A1507, A1516, A1526 (China), A1529 | Global) @"iPhone6,1" :@"iPhone 5s", // (model A1433, A1533 | GSM) @"iPhone6,2" :@"iPhone 5s", // (model A1457, A1518, A1528 (China), A1530 | Global) @"iPhone7,1" :@"iPhone 6 Plus", // @"iPhone7,2" :@"iPhone 6", // @"iPad4,1" :@"iPad Air", // 5th Generation iPad (iPad Air) - Wifi @"iPad4,2" :@"iPad Air", // 5th Generation iPad (iPad Air) - Cellular @"iPad4,4" :@"iPad Mini", // (2nd Generation iPad Mini - Wifi) @"iPad4,5" :@"iPad Mini" // (2nd Generation iPad Mini - Cellular) }; } NSString* deviceName = [deviceNamesByCode objectForKey:code]; if (!deviceName) { // Not found on database. At least guess main device type from string contents: if ([code rangeOfString:@"iPod"].location != NSNotFound) { deviceName = @"iPod Touch"; } else if([code rangeOfString:@"iPad"].location != NSNotFound) { deviceName = @"iPad"; } else if([code rangeOfString:@"iPhone"].location != NSNotFound){ deviceName = @"iPhone"; } } return deviceName; } // (rest of class implementation omitted) @end
转自:
http://stackoverflow.com/questions/11197509/ios-how-to-get-device-make-and-model
相关文章推荐
- ios,设备标签与设备型号的对应关系
- iOS设备型号标签列表
- 反欺诈技术揭秘-设备指纹VS关系网络模型 此博文包含图片 (2017-05-12 10:23:52)转载▼ 标签: 设备指纹 关系网络 反欺诈 神经网络模型 分类: 风控 文章来源:网络(经整合梳理
- iOS 设备型号判断及对应固件的选择
- iphone手机型号对应iOS系统版本及设备标签
- iOS获取当前设备型号等信息(全)包含iPhone7和iPhone7P
- iOS设备型号标签列表
- ios 获取设备型号 最新(包含iphone6 and 6 plus)
- iOS获取当前设备型号等信息总结 包含iPhone7和iPhone7P
- 2015-10-14 iOS获取最新设备型号方法
- XZ_iOS之iPhone设备屏幕尺寸、分辨率以及对应的切图
- iOS获取设备标识符、型号等信息
- IOS-获取Model(设备型号)、Version(设备版本号)、app(程序版本号)等
- 获取当前IOS设备的CPU型号,CPU核数,GPU,GPU核数,屏幕分辨率,屏幕尺寸,PPI等信息
- ios 判断当前的设备是那一种型号
- iOS Device Types(设备型号:iPhone Model)
- ios 得到设备型号,设备类型
- iOS 设备型号对照表
- IOS-获取Model(设备型号)、Version(设备版本号)、app(程序版本号)等
- iOS获取屏幕宽高、设备型号、系统版本信息