Monday, November 18, 2013

How to get iDevice hardware model

size_t size = 100;
char *hw_machine = malloc(size);
int name[] = {CTL_HW,HW_MACHINE};
sysctl(name, 2, hw_machine, &size, NULL, 0);
NSString *hardware = [NSString stringWithUTF8String:hw_machine]; //e.g. iPhone4,1
free(hw_machine);

No comments: