NSString * getDeviceType() {
size_t size;
sysctlbyname("hw.machine", NULL, &size, NULL, 0);
char *machine = malloc(size);
sysctlbyname("hw.machine", machine, &size, NULL, 0);
NSString *deviceType = [NSString stringWithCString:machine
encoding:NSUTF8StringEncoding];
free(machine);
if ([deviceType isEqualToString:@"iPhone1,1"]) return @"iPhone 2G";
if ([deviceType isEqualToString:@"iPhone1,2"]) return @"iPhone 3G";
if ([deviceType isEqualToString:@"iPhone2,1"]) return @"iPhone 3GS";
if ([deviceType isEqualToString:@"iPhone3,1"]) return @"iPhone 4";
if ([deviceType isEqualToString:@"iPhone3,2"]) return @"iPhone 4";
if ([deviceType isEqualToString:@"iPhone3,3"]) return @"iPhone 4";
if ([deviceType isEqualToString:@"iPhone4,1"]) return @"iPhone 4S";
if ([deviceType isEqualToString:@"iPhone5,1"]) return @"iPhone 5";
if ([deviceType isEqualToString:@"iPhone5,2"]) return @"iPhone 5 (GSM+CDMA)";
if ([deviceType isEqualToString:@"iPhone5,3"]) return @"iPhone 5c (GSM)";
if ([deviceType isEqualToString:@"iPhone5,4"]) return @"iPhone 5c (GSM+CDMA)";
if ([deviceType isEqualToString:@"iPhone6,1"]) return @"iPhone 5s (GSM)";
if ([deviceType isEqualToString:@"iPhone6,2"]) return @"iPhone 5s (GSM+CDMA)";
if ([deviceType isEqualToString:@"iPhone7,1"]) return @"iPhone 6 Plus";
if ([deviceType isEqualToString:@"iPhone7,2"]) return @"iPhone 6";
if ([deviceType isEqualToString:@"iPhone8,1"]) return @"iPhone 6s";
if ([deviceType isEqualToString:@"iPhone8,2"]) return @"iPhone 6s Plus";
if ([deviceType isEqualToString:@"iPhone8,4"]) return @"iPhone SE";
if ([deviceType isEqualToString:@"iPhone9,1"]) return @"iPhone 7";
if ([deviceType isEqualToString:@"iPhone9,3"]) return @"iPhone 7";
if ([deviceType isEqualToString:@"iPhone9,2"]) return @"iPhone 7 Plus";
if ([deviceType isEqualToString:@"iPhone9,4"]) return @"iPhone 7 Plus";
if ([deviceType isEqualToString:@"iPhone10,1"]) return @"iPhone 8";
if ([deviceType isEqualToString:@"iPhone10,4"]) return @"iPhone 8";
if ([deviceType isEqualToString:@"iPhone10,2"]) return @"iPhone 8 Plus";
if ([deviceType isEqualToString:@"iPhone10,5"]) return @"iPhone 8 Plus";
if ([deviceType isEqualToString:@"iPhone10,3"]) return @"iPhone X";
if ([deviceType isEqualToString:@"iPhone10,6"]) return @"iPhone X";
if ([deviceType isEqualToString:@"iPhone11,8"]) return @"iPhone XR";
if ([deviceType isEqualToString:@"iPhone11,2"]) return @"iPhone XS";
if ([deviceType isEqualToString:@"iPhone11,4"]) return @"iPhone XS Max";
if ([deviceType isEqualToString:@"iPhone11,6"]) return @"iPhone XS Max";
if ([deviceType isEqualToString:@"iPod1,1"]) return @"iPod Touch (1 Gen)";
if ([deviceType isEqualToString:@"iPod2,1"]) return @"iPod Touch (2 Gen)";
if ([deviceType isEqualToString:@"iPod3,1"]) return @"iPod Touch (3 Gen)";
if ([deviceType isEqualToString:@"iPod4,1"]) return @"iPod Touch (4 Gen)";
if ([deviceType isEqualToString:@"iPod5,1"]) return @"iPod Touch (5 Gen)";
if ([deviceType isEqualToString:@"iPad1,1"]) return @"iPad";
if ([deviceType isEqualToString:@"iPad1,2"]) return @"iPad 3G";
if ([deviceType isEqualToString:@"iPad2,1"]) return @"iPad 2 (WiFi)";
if ([deviceType isEqualToString:@"iPad2,2"]) return @"iPad 2";
if ([deviceType isEqualToString:@"iPad2,3"]) return @"iPad 2 (CDMA)";
if ([deviceType isEqualToString:@"iPad2,4"]) return @"iPad 2";
if ([deviceType isEqualToString:@"iPad2,5"]) return @"iPad Mini (WiFi)";
if ([deviceType isEqualToString:@"iPad2,6"]) return @"iPad Mini";
if ([deviceType isEqualToString:@"iPad2,7"]) return @"iPad Mini (GSM+CDMA)";
if ([deviceType isEqualToString:@"iPad3,1"]) return @"iPad 3 (WiFi)";
if ([deviceType isEqualToString:@"iPad3,2"]) return @"iPad 3 (GSM+CDMA)";
if ([deviceType isEqualToString:@"iPad3,3"]) return @"iPad 3";
if ([deviceType isEqualToString:@"iPad3,4"]) return @"iPad 4 (WiFi)";
if ([deviceType isEqualToString:@"iPad3,5"]) return @"iPad 4";
if ([deviceType isEqualToString:@"iPad3,6"]) return @"iPad 4 (GSM+CDMA)";
if ([deviceType isEqualToString:@"iPad4,1"]) return @"iPad Air (WiFi)";
if ([deviceType isEqualToString:@"iPad4,2"]) return @"iPad Air (Cellular)";
if ([deviceType isEqualToString:@"iPad4,4"]) return @"iPad Mini 2 (WiFi)";
if ([deviceType isEqualToString:@"iPad4,5"]) return @"iPad Mini 2 (Cellular)";
if ([deviceType isEqualToString:@"iPad4,6"]) return @"iPad Mini 2";
if ([deviceType isEqualToString:@"iPad4,7"]) return @"iPad Mini 3";
if ([deviceType isEqualToString:@"iPad4,8"]) return @"iPad Mini 3";
if ([deviceType isEqualToString:@"iPad4,9"]) return @"iPad Mini 3";
if ([deviceType isEqualToString:@"iPad5,3"]) return @"iPad Air 2";
if ([deviceType isEqualToString:@"iPad5,4"]) return @"iPad Air 2";
if ([deviceType isEqualToString:@"iPad6,3"]) return @"iPad Pro 9.7";
if ([deviceType isEqualToString:@"iPad6,4"]) return @"iPad Pro 9.7";
if ([deviceType isEqualToString:@"iPad6,7"]) return @"iPad Pro 12.9";
if ([deviceType isEqualToString:@"iPad6,8"]) return @"iPad Pro 12.9";
if ([deviceType isEqualToString:@"iPad7,1"]) return @"iPad Pro 12.9";
if ([deviceType isEqualToString:@"iPad7,2"]) return @"iPad Pro 12.9";
if ([deviceType isEqualToString:@"iPad8,5"]) return @"iPad Pro 12.9";
if ([deviceType isEqualToString:@"iPad8,6"]) return @"iPad Pro 12.9";
if ([deviceType isEqualToString:@"iPad8,7"]) return @"iPad Pro 12.9";
if ([deviceType isEqualToString:@"iPad8,8"]) return @"iPad Pro 12.9";
if ([deviceType isEqualToString:@"iPad7,3"]) return @"iPad Pro 10.5";
if ([deviceType isEqualToString:@"iPad7,4"]) return @"iPad Pro 10.5";
if ([deviceType isEqualToString:@"iPad8,1"]) return @"iPad Pro 11.0";
if ([deviceType isEqualToString:@"iPad8,2"]) return @"iPad Pro 11.0";
if ([deviceType isEqualToString:@"iPad8,3"]) return @"iPad Pro 11.0";
if ([deviceType isEqualToString:@"iPad8,4"]) return @"iPad Pro 11.0";
if ([deviceType isEqualToString:@"i386"]) return @"Simulator";
if ([deviceType isEqualToString:@"x86_64"]) return @"Simulator";
return @"unknown";
}