iOS App开发中一些经常要用到的方法一 (获取机器具体型号)今年最新的7和7plus也在

1.获取机器具体型号

//获得设备型号

+ (NSString*)getCurrentDeviceModel{

structutsnamesystemInfo;

uname(&systemInfo);

NSString*platform = [NSStringstringWithCString:systemInfo.machineencoding:NSUTF8StringEncoding];

if([platformisEqualToString:@"iPhone1,1"])return@"iPhone 2 ";

if([platformisEqualToString:@"iPhone1,2"])return@"iPhone 3";

if([platformisEqualToString:@"iPhone2,1"])return@"iPhone 3S";

if([platformisEqualToString:@"iPhone3,1"])return@"iPhone 4";

if([platformisEqualToString:@"iPhone3,2"])return@"iPhone 4";

if([platformisEqualToString:@"iPhone3,3"])return@"iPhone 4";

if([platformisEqualToString:@"iPhone4,1"])return@"iPhone 4S";

if([platformisEqualToString:@"iPhone5,1"])return@"iPhone 5";

if([platformisEqualToString:@"iPhone5,2"])return@"iPhone 5 (GSM+CDMA)";

if([platformisEqualToString:@"iPhone5,3"])return@"iPhone 5c (GSM)";

if([platformisEqualToString:@"iPhone5,4"])return@"iPhone 5c (GSM+CDMA)";

if([platformisEqualToString:@"iPhone6,1"])return@"iPhone 5s (GSM)";

if([platformisEqualToString:@"iPhone6,2"])return@"iPhone 5s (GSM+CDMA)";

if([platformisEqualToString:@"iPhone7,1"])return@"iPhone 6 Plus";

if([platformisEqualToString:@"iPhone7,2"])return@"iPhone 6";

if([platformisEqualToString:@"iPhone8,1"])return@"iPhone 6S";

if([platformisEqualToString:@"iPhone8,2"])return@"iPhone 6S Plus";

if([platformisEqualToString:@"iPhone8,4"])return@"iPhone SE";

if([platformisEqualToString:@"iPhone9,1"])return@"iPhone 5S";

if([platformisEqualToString:@"iPhone9,2"])return@"iPhone 7Plus";

if([platformisEqualToString:@"iPhone9,3"])return@"iPhone 7";

if([platformhasPrefix:@"iPhone"])return@"iPhone新机器";

//iPod

if([platformisEqualToString:@"iPod1,1"])return@"iPod Touch 1";

if([platformisEqualToString:@"iPod2,1"])return@"iPod Touch 2";

if([platformisEqualToString:@"iPod3,1"])return@"iPod Touch 3";

if([platformisEqualToString:@"iPod4,1"])return@"iPod Touch 4";

if([platformisEqualToString:@"iPod5,1"])return@"iPod Touch 5";

if([platformhasPrefix:@"iPod"])return@"iPod新机器";

//iPad

if([platformisEqualToString:@"iPad1,1"])return@"iPad 1(WiFi)";

if([platformisEqualToString:@"iPad1,2"])return@"iPad 1(3G)";

if([platformisEqualToString:@"iPad2,1"])return@"iPad 2 (WiFi)";

if([platformisEqualToString:@"iPad2,2"])return@"iPad 2";

if([platformisEqualToString:@"iPad2,3"])return@"iPad 2 (CDMA)";

if([platformisEqualToString:@"iPad2,4"])return@"iPad 2";

if([platformisEqualToString:@"iPad2,5"])return@"iPad Mini (WiFi)";

if([platformisEqualToString:@"iPad2,6"])return@"iPad Mini";

if([platformisEqualToString:@"iPad2,7"])return@"iPad Mini (GSM+CDMA)";

if([platformisEqualToString:@"iPad3,1"])return@"iPad 3 (WiFi)";

if([platformisEqualToString:@"iPad3,2"])return@"iPad 3 (GSM+CDMA)";

if([platformisEqualToString:@"iPad3,3"])return@"iPad 3";

if([platformisEqualToString:@"iPad3,4"])return@"iPad 4 (WiFi)";

if([platformisEqualToString:@"iPad3,5"])return@"iPad 4";

if([platformisEqualToString:@"iPad3,6"])return@"iPad 4 (GSM+CDMA)";

if([platformisEqualToString:@"iPad4,1"])return@"iPad Air (WiFi)";

if([platformisEqualToString:@"iPad4,2"])return@"iPad Air (Cellular)";

if([platformisEqualToString:@"iPad4,4"])return@"iPad Mini 2 (WiFi)";

if([platformisEqualToString:@"iPad4,5"])return@"iPad Mini 2 (Cellular)";

if([platformisEqualToString:@"iPad4,6"])return@"iPad Mini 2";

if([platformisEqualToString:@"iPad4,7"])return@"iPad Mini 3";

if([platformisEqualToString:@"iPad4,8"])return@"iPad Mini 3";

if([platformisEqualToString:@"iPad4,9"])return@"iPad Mini 3";

if([platformisEqualToString:@"iPad5,1"])return@"iPad Mini 4 (WiFi)";

if([platformisEqualToString:@"iPad5,2"])return@"iPad Mini 4 (LTE)";

if([platformisEqualToString:@"iPad5,3"])return@"iPad Air 2";

if([platformisEqualToString:@"iPad5,4"])return@"iPad Air 2";

if([platformisEqualToString:@"iPad6,3"])return@"iPad Pro 9.7";

if([platformisEqualToString:@"iPad6,4"])return@"iPad Pro 9.7";

if([platformisEqualToString:@"iPad6,7"])return@"iPad Pro 12.9";

if([platformisEqualToString:@"iPad6,8"])return@"iPad Pro 12.9";

if([platformhasPrefix:@"iPad"])return@"iPad新机器";

if([platformisEqualToString:@"i386"])return@"iPhone Simulator";

if([platformisEqualToString:@"x86_64"])return@"iPhone Simulator";

returnplatform;

你可能感兴趣的:(iOS App开发中一些经常要用到的方法一 (获取机器具体型号)今年最新的7和7plus也在)