#include
#include
/*
Platforms
iPhone1,1 -> iPhone 2G
iPhone1,2 -> iPhone 3G
iPhone2,1 -> iPhone 3GS
iPhone3,1 -> iPhone 4 GSM
iPhone3,3 -> iPhone 4 CDMA
iPhone4,1 -> iPhone 4S
iPod1,1 -> iPod touch 1G
iPod2,1 -> iPod touch 2G
iPod3,1 -> iPod touch 3G
iPad1,1 -> iPad (Wifi or GSM)
iPad2,1 -> iPad 2 Wifi
iPad2,2 -> iPad 2 GSM
iPad2,3 -> iPad 2 CDMA
*/
+ (NSString *) devicePlatform
{
size_t size;
sysctlbyname("hw.machine", NULL, &size, NULL, 0);
char *machine = (char *)malloc(size);
sysctlbyname("hw.machine", machine, &size, NULL, 0);
NSString *platform = [NSString stringWithCString: machine encoding: NSUTF8StringEncoding];
free(machine);
return platform;
}
iOS6.1 - Tested.
No comments:
Post a Comment