Equipment judgment
+ (NSString *) devicestring
{
Need #import "Sys/utsname.h"
struct Utsname systemInfo;
Uname (&systeminfo);
NSString *devicestring = [NSString stringWithCString:systemInfo.machine encoding:nsutf8stringencoding];
if ([devicestring isequaltostring:@ "iphone1,1"]) return @ "IPhone 1G";
if ([devicestring isequaltostring:@ "iphone1,2"]) return @ "IPhone 3G";
if ([devicestring isequaltostring:@ "iphone2,1"]) return @ "IPhone 3GS";
if ([devicestring isequaltostring:@ "iphone3,1"]) return @ "IPhone 4";
if ([devicestring isequaltostring:@ "iphone3,3"]) return @ "Verizon IPhone 4";
if ([devicestring isequaltostring:@ "iphone4,1"]) return @ "IPhone 4S";
if ([devicestring isequaltostring:@ "iphone5,1"]) return @ "IPhone 5 (GSM)";
if ([devicestring isequaltostring:@ "iphone5,2"]) return @ "IPhone 5 (GSM+CDMA)";
if ([devicestring isequaltostring:@ "iphone5,3"]) return @ "IPhone 5c (GSM)";
if ([devicestring isequaltostring:@ "iphone5,4"]) return @ "IPhone 5c (GSM+CDMA)";
if ([devicestring isequaltostring:@ "iphone6,1"]) return @ "IPhone 5s (GSM)";
if ([devicestring isequaltostring:@ "iphone6,2"]) return @ "IPhone 5s (GSM+CDMA)";
if ([devicestring isequaltostring:@ "iphone7,2"]) return @ "IPhone 6";
if ([devicestring isequaltostring:@ "iphone7,1"]) return @ "IPhone 6 Plus";
if ([devicestring isequaltostring:@ "ipod1,1"]) return @ "IPod Touch 1G";
if ([devicestring isequaltostring:@ "ipod2,1"]) return @ "IPod Touch 2G";
if ([devicestring isequaltostring:@ "ipod3,1"]) return @ "IPod Touch 3G";
if ([devicestring isequaltostring:@ "ipod4,1"]) return @ "IPod Touch 4G";
if ([devicestring isequaltostring:@ "ipod5,1"]) return @ "IPod Touch 5G";
if ([devicestring isequaltostring:@ "ipad1,1"]) return @ "IPad";
if ([devicestring isequaltostring:@ "ipad2,1"]) return @ "IPad 2 (WiFi)";
if ([devicestring isequaltostring:@ "ipad2,2"]) return @ "IPad 2 (GSM)";
if ([devicestring isequaltostring:@ "ipad2,3"]) return @ "IPad 2 (CDMA)";
if ([devicestring isequaltostring:@ "ipad2,4"]) return @ "IPad 2 (WiFi)";
if ([devicestring isequaltostring:@ "ipad2,5"]) return @ "IPad Mini (WiFi)";
if ([devicestring isequaltostring:@ "ipad2,6"]) return @ "IPad Mini (GSM)";
if ([devicestring isequaltostring:@ "ipad2,7"]) return @ "IPad Mini (GSM+CDMA)";
if ([devicestring isequaltostring:@ "ipad3,1"]) return @ "IPad 3 (WiFi)";
if ([devicestring isequaltostring:@ "ipad3,2"]) return @ "IPad 3 (GSM+CDMA)";
if ([devicestring isequaltostring:@ "ipad3,3"]) return @ "IPad 3 (GSM)";
if ([devicestring isequaltostring:@ "ipad3,4"]) return @ "IPad 4 (WiFi)";
if ([devicestring isequaltostring:@ "ipad3,5"]) return @ "IPad 4 (GSM)";
if ([devicestring isequaltostring:@ "ipad3,6"]) return @ "IPad 4 (GSM+CDMA)";
if ([devicestring isequaltostring:@ "ipad4,1"]) return @ "IPad Air (WiFi)";
if ([devicestring isequaltostring:@ "ipad4,2"]) return @ "IPad Air (Cellular)";
if ([devicestring isequaltostring:@ "ipad4,3"]) return @ "IPad Air";
if ([devicestring isequaltostring:@ "ipad4,4"]) return @ "IPad Mini 2G (WiFi)";
if ([devicestring isequaltostring:@ "ipad4,5"]) return @ "IPad Mini 2G (Cellular)";
if ([devicestring isequaltostring:@ "ipad4,6"]) return @ "IPad Mini 2G";
if ([devicestring isequaltostring:@ "ipad4,7"]) return @ "IPad Mini 3 (WiFi)";
if ([devicestring isequaltostring:@ "ipad4,8"]) return @ "IPad Mini 3 (Cellular)";
if ([devicestring isequaltostring:@ "ipad4,9"]) return @ "IPad Mini 3 (China)";
if ([devicestring isequaltostring:@ "ipad5,3"]) return @ "IPad Air 2 (WiFi)";
if ([devicestring isequaltostring:@ "ipad5,4"]) return @ "IPad Air 2 (Cellular)";
if ([devicestring isequaltostring:@ "appletv2,1"]) return @ "Apple TV 2G";
if ([devicestring isequaltostring:@ "appletv3,1"]) return @ "Apple TV 3";
if ([devicestring isequaltostring:@ "appletv3,2"]) return @ "Apple TV 3 (2013)";
if ([devicestring isequaltostring:@ "i386"]) return @ "Simulator";
if ([devicestring isequaltostring:@ "x86_64"]) return @ "Simulator";
NSLog (@ "Note:unknown device type:%@", devicestring);
return devicestring;
}
iOS device judgment