Hi All.
I do not like iPhone.generation…
How to get hw.machine name of С# or JS?
Of Obj-C you can so use this code…
-(void) getPlatform
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
size_t size;
sysctlbyname("hw.machine", NULL, &size, NULL, 0);
char *machine = new char[size];
sysctlbyname("hw.machine", machine, &size, NULL, 0);
////////////////////////////////////////////////////////////////////////////////////
if (!strcasecmp(machine, "iPhone1,1")) {} // "iPhone1G GSM"
else if (!strcasecmp(machine, "iPhone1,2")) {} // iPhone3G GSM"
else if (!strcasecmp(machine, "iPhone2,1")) {} // "iPhone3GS GSM"
else if (!strcasecmp(machine, "iPhone3,1")) {} // "iPhone4 GSM";
else if (!strcasecmp(machine, "iPhone3,2")) {} // "iPhone4 CDMAV";
else if (!strcasecmp(machine, "iPhone3,3")) {} // "iPhone4 CDMAS"
else if (!strcasecmp(machine, "iPhone4,1")) {} // "iPhone4S"
else if (!strncmp(machine, "iPhone5", 7)) {} // "iPhone5"
else if (!strncmp(machine, "iPhone", 6)) {} // "UNKNOWN"
//
else if (!strcasecmp(machine, "iPod1,1")) {} // "iPod 1G"
else if (!strcasecmp(machine, "iPod2,1")) {} // "iPod 2G"
else if (!strcasecmp(machine, "iPod3,1")) {} // "iPod 3G"
else if (!strcasecmp(machine, "iPod4,1")) {} // "iPod 4G"
else if (!strcasecmp(machine, "iPod5,1")) {} // "iPod 5G"
else if (!strncmp(machine, "iPod", 4)) {} // "UNKNOWN"
//
else if (!strncmp(machine, "iPad1", 5)) {} // "iPad WiFi"
else if (!strcasecmp(machine, "iPad2,1")) {} // "iPad2 WiFi"
else if (!strcasecmp(machine, "iPad2,2")) {} // "iPad2 GSM"
else if (!strcasecmp(machine, "iPad2,3")) {} // "iPad2 CDMAV"
else if (!strcasecmp(machine, "iPad2,4")) {} // "iPad2 CDMAS"
else if (!strcasecmp(machine, "iPad2,5")) {} // "iPad_MINI"
else if (!strcasecmp(machine, "iPad2,6")) {} // "iPad_MINI"
else if (!strcasecmp(machine, "iPad2,7")) {} // "iPad_MINI
else if (!strncmp(machine, "iPad2", 5)) {} // "iPad2 UNKNOWN"
else if (!strcasecmp(machine, "iPad3,1")) {} // "iPad3 Wi-Fi"
else if (!strcasecmp(machine, "iPad3,2")) {} // "iPad3 GSM"
else if (!strcasecmp(machine, "iPad3,3")) {} // "iPad3 CDMA"
else if (!strcasecmp(machine, "iPad3,4")) {} // "iPad4"
else if (!strcasecmp(machine, "iPad3,5")) {} // "iPad4
else if (!strcasecmp(machine, "iPad3,6")) {} // "iPad4
else if (!strncmp(machine, "iPad3", 5)) {} // "iPad3 UNKNOWN"
else if (!strncmp(machine, "iPad", 4)) {} // "UNKNOWN"
//
SAFE_DEL_ARRAY(machine);
[pool release];
}