#include <sys/types.h>
#include <sys/sysctl.h>
Get the device model
+ (NSString *) Getcurrentdevicemodel: (Uiviewcontroller *) controller
{
int mib[2];
size_t Len;
Char *machine;
Mib[0] = CTL_HW;
MIB[1] = Hw_machine;
Sysctl (MIB, 2, NULL, &len, NULL, 0);
Machine = malloc (len);
Sysctl (MIB, 2, machine, &len, NULL, 0);
NSString *platform = [NSString stringwithcstring:machine encoding:nsasciistringencoding];
Free (machine);
if ([Platform isequaltostring:@ "iphone1,1"]) return @ "IPhone 2G (A1203)";
if ([Platform isequaltostring:@ "iphone1,2"]) return @ "IPhone 3G (a1241/a1324)";
if ([Platform isequaltostring:@ "iphone2,1"]) return @ "IPhone 3GS (a1303/a1325)";
if ([Platform isequaltostring:@ "iphone3,1"]) return @ "IPhone 4 (A1332)";
if ([Platform isequaltostring:@ "iphone3,2"]) return @ "IPhone 4 (A1332)";
if ([Platform isequaltostring:@ "iphone3,3"]) return @ "IPhone 4 (A1349)";
if ([Platform isequaltostring:@ "iphone4,1"]) return @ "IPhone 4S (a1387/a1431)";
if ([Platform isequaltostring:@ "iphone5,1"]) return @ "IPhone 5 (A1428)";
if ([Platform isequaltostring:@ "iphone5,2"]) return @ "IPhone 5 (a1429/a1442)";
if ([Platform isequaltostring:@ "iphone5,3"]) return @ "IPhone 5c (a1456/a1532)";
if ([Platform isequaltostring:@ "iphone5,4"]) return @ "IPhone 5c (a1507/a1516/a1526/a1529)";
if ([Platform isequaltostring:@ "iphone6,1"]) return @ "IPhone 5s (a1453/a1533)";
if ([Platform isequaltostring:@ "iphone6,2"]) return @ "IPhone 5s (a1457/a1518/a1528/a1530)";
if ([Platform isequaltostring:@ "iphone7,1"]) return @ "IPhone 6 Plus (a1522/a1524)";
if ([Platform isequaltostring:@ "iphone7,2"]) return @ "IPhone 6 (a1549/a1586)";
if ([Platform isequaltostring:@ "ipod1,1"]) return @ "IPod Touch 1G (A1213)";
if ([Platform isequaltostring:@ "ipod2,1"]) return @ "IPod Touch 2G (A1288)";
if ([Platform isequaltostring:@ "ipod3,1"]) return @ "IPod Touch 3G (A1318)";
if ([Platform isequaltostring:@ "ipod4,1"]) return @ "IPod Touch 4G (A1367)";
if ([Platform isequaltostring:@ "ipod5,1"]) return @ "IPod Touch 5G (a1421/a1509)";
if ([Platform isequaltostring:@ "ipad1,1"]) return @ "IPad 1G (a1219/a1337)";
if ([Platform isequaltostring:@ "ipad2,1"]) return @ "IPad 2 (A1395)";
if ([Platform isequaltostring:@ "ipad2,2"]) return @ "IPad 2 (A1396)";
if ([Platform isequaltostring:@ "ipad2,3"]) return @ "IPad 2 (A1397)";
if ([Platform isequaltostring:@ "ipad2,4"]) return @ "IPad 2 (a1395+new Chip)";
if ([Platform isequaltostring:@ "ipad2,5"]) return @ "IPad Mini 1G (A1432)";
if ([Platform isequaltostring:@ "ipad2,6"]) return @ "IPad Mini 1G (A1454)";
if ([Platform isequaltostring:@ "ipad2,7"]) return @ "IPad Mini 1G (A1455)";
if ([Platform isequaltostring:@ "ipad3,1"]) return @ "IPad 3 (A1416)";
if ([Platform isequaltostring:@ "ipad3,2"]) return @ "IPad 3 (A1403)";
if ([Platform isequaltostring:@ "ipad3,3"]) return @ "IPad 3 (A1430)";
if ([Platform isequaltostring:@ "ipad3,4"]) return @ "IPad 4 (A1458)";
if ([Platform isequaltostring:@ "ipad3,5"]) return @ "IPad 4 (A1459)";
if ([Platform isequaltostring:@ "ipad3,6"]) return @ "IPad 4 (A1460)";
if ([Platform isequaltostring:@ "ipad4,1"]) return @ "IPad Air (A1474)";
if ([Platform isequaltostring:@ "ipad4,2"]) return @ "IPad Air (A1475)";
if ([Platform isequaltostring:@ "ipad4,3"]) return @ "IPad Air (A1476)";
if ([Platform isequaltostring:@ "ipad4,4"]) return @ "IPad Mini 2G (A1489)";
if ([Platform isequaltostring:@ "ipad4,5"]) return @ "IPad Mini 2G (A1490)";
if ([Platform isequaltostring:@ "ipad4,6"]) return @ "IPad Mini 2G (A1491)";
if ([Platform isequaltostring:@ "i386"]) return @ "IPhone Simulator";
if ([Platform isequaltostring:@ "x86_64"]) return @ "IPhone Simulator";
return platform;
}
This judgment is all up ... 5 and 5s yourself to take useful bai
Get the device model