Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find iPhone Model information

Tags:

iphone

While it's not good practise to find out and use this information in your application, is there a way to find what model of iPhone / iPod / iPad you have. For example: 2G/3GS/4G etc

like image 514
ingh.am Avatar asked Oct 21 '10 20:10

ingh.am


1 Answers

Try:

char    deviceString[256];
size_t  size = 255;
sysctlbyname("hw.machine", NULL, &size, NULL, 0);
if (size > 255) { size = 255; }
sysctlbyname("hw.machine", deviceString, &size, NULL, 0);
if (strcmp(deviceString,"iPhone1,1") == 0) { etc... }  // 2G

1,2 is a 3G, 2,1 is a 3GS, 3,1 is an i4, etc.

like image 154
hotpaw2 Avatar answered Sep 19 '22 00:09

hotpaw2