I have the following code
@implementation UIDevice(machine)
- (NSString *)machine
{
size_t size;
sysctlbyname("hw.machine", NULL, &size, NULL, 0);
char *name = malloc(size);
sysctlbyname("hw.machine", name, &size, NULL, 0);
NSString *machine = [NSString stringWithCString:name];
free(name);
return machine;
}
@end
NSLog(@"device: %@", [[UIDevice currentDevice] machine]);
I get output like:
Platforms:
iPhone1,1
iPhone1,2
iPod1,1
iPod2,1
that the two numbers added after iphone / ipod touch are i, e (1,1), (1,2), etc.
Thanks Biranchi
source
share