#pragma mark - 获取手机型号
+ (NSString *)iphoneType {
// 需要导入头文件:#import <sys/utsname.h>
struct utsname systemInfo;
uname(&systemInfo);
NSString *platform = [NSString stringWithCString:systemInfo.machine encoding:NSASCIIStringEncoding];
if ([platform isEqualToString:@"iPhone1,1"]) return @"iPhone 2G";
if ([platform isEqualToString:@"iPhone1,2"]) return @"iPhone 3G";
if ([platform isEqualToString:@"iPhone2,1"]) return @"iPhone 3GS";
if ([platform isEqualToString:@"iPhone3,1"]) return @"iPhone 4";
if ([platform isEqualToString:@"iPhone3,2"]) return @"iPhone 4";
if ([platform isEqualToString:@"iPhone3,3"]) return @"iPhone 4";
if ([platform isEqualToString:@"iPhone4,1"]) return @"iPhone 4S";
if ([platform isEqualToString:@"iPhone5,1"]) return @"iPhone 5";
if ([platform isEqualToString:@"iPhone5,2"]) return @"iPhone 5";
if ([platform isEqualToString:@"iPhone5,3"]) return @"iPhone 5c";
if ([platform isEqualToString:@"iPhone5,4"]) return @"iPhone 5c";
if ([platform isEqualToString:@"iPhone6,1"]) return @"iPhone 5s";
if ([platform isEqualToString:@"iPhone6,2"]) return @"iPhone 5s";
if ([platform isEqualToString:@"iPhone7,1"]) return @"iPhone 6 Plus";
if ([platform isEqualToString:@"iPhone7,2"]) return @"iPhone 6";
if ([platform isEqualToString:@"iPhone8,1"]) return @"iPhone 6s";
if ([platform isEqualToString:@"iPhone8,2"]) return @"iPhone 6s Plus";
if ([platform isEqualToString:@"iPhone8,4"]) return @"iPhone SE";
if ([platform isEqualToString:@"iPhone9,1"]) return @"iPhone 7";//国行、日版、港行
if ([platform isEqualToString:@"iPhone9,2"]) return @"iPhone 7 Plus";//港行、国行
if ([platform isEqualToString:@"iPhone9,3"]) return @"iPhone 7";//美版、台版
if ([platform isEqualToString:@"iPhone9,4"]) return @"iPhone 7 Plus";//美版、台版
if ([platform isEqualToString:@"iPhone10,1"]) return @"iPhone 8";//国行(A1863)、日行(A1906)
if ([platform isEqualToString:@"iPhone10,4"]) return @"iPhone 8";//美版(Global/A1905)
if ([platform isEqualToString:@"iPhone10,2"]) return @"iPhone 8 Plus";//国行(A1864)、日行(A1898)
if ([platform isEqualToString:@"iPhone10,5"]) return @"iPhone 8 Plus";//美版(Global/A1897)
if ([platform isEqualToString:@"iPhone10,3"]) return @"iPhone X";//国行(A1865)、日行(A1902)
if ([platform isEqualToString:@"iPhone10,6"]) return @"iPhone X";//美版(Global/A1901)
if ([platform isEqualToString:@"iPhone11,8"]) return @"iPhone XR";
if ([platform isEqualToString:@"iPhone11,2"]) return @"iPhone XS";
if ([platform isEqualToString:@"iPhone11,6"]) return @"iPhone XS Max";
if ([platform isEqualToString:@"iPhone11,4"]) return @"iPhone XS Max";
return platform;
}
iOS获取手机型号
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 获取手机型号需要导入 import "sys/utsname.h" 获取运行商需要导入 import <CoreT...
- ·开发中,为了更好的用户体验或者为了bug跟踪,可能会需要获取用户的应用信息、系统信息、设备信息。这些信息的获取可...
- 获取手机型号需要导入 import "sys/utsname.h" 获取运行商需要导入 import <CoreT...
- iOS获取手机型号 分为4步 1.引入utsname文件 2.获取手机型号代码model 3.将手机型号代码转为手...