Find iPhone Information

Although it is not a good practice to learn and use this information in your application, is there a way to find which iPhone / iPod / iPad model you have. For example: 2G / 3GS / 4G, etc.

+6
iphone
source share
4 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 3G, 2.1 is 3GS, 3.1 is i4, etc.

+7
source share

I think they have already answered this: Identify the device (iPhone, iPod Touch) with the iPhone SDK , although I added a little:

 - (NSString *) platformString{ NSString *platform = [self platform]; if ([platform isEqualToString:@"iPhone1,1"]) return @"iPhone 1G"; if ([platform isEqualToString:@"iPhone1,2"]) return @"iPhone 3G"; if ([platform isEqualToString:@"iPhone2,1"]) return @"iPhone 3GS"; if ([platform isEqualToString:@"iPhone3,1"]) return @"iPhone 4"; if ([platform isEqualToString:@"iPod1,1"]) return @"iPod Touch 1G"; if ([platform isEqualToString:@"iPod2,1"]) return @"iPod Touch 2G"; if ([platform isEqualToString:@"iPod3,1"]) return @"iPod Touch 3G"; if ([platform isEqualToString:@"iPod4,1"]) return @"iPod Touch 4G"; if ([platform isEqualToString:@"iPad1,1"]) return @"iPad"; if ([platform isEqualToString:@"i386"]) return @"iPhone Simulator"; return platform; 

}

to account for the latest additions to the family. You can check everyipod.com, for example, the specs for the iPhone 4 , to get the platform strings.

+6
source share

-[UIDevice model] , but I'm not sure if it returns anything more specific than the โ€œiPhoneโ€ or โ€œiPod Touchโ€.

+1
source share

I thought iTunes / Xcode Organizer did this already for some reason (at least it looks like I remember correctly identifying my old iPod Touch as the 1st gene), which is definitely not for the iPhone 3GS. Also, the iPhone setup utility does not help.

So, I activated System Profiler to find out if the device appears in the USB list; it does. It also shows "Product Identifier" (in my case, 0x1294). I typed this on Google and came up with the following:

http://theiphonewiki.com/wiki/index.php?title=Normal_Mode

Device identifiers

It looks like it uses different device identifiers:

iPhone - 0x1290

iPod touch - 0x1291

iPhone 3G - 0x1292

iPod touch 2G - 0x1293

iPhone 3GS - 0x1294

iPod touch 3G - 0x1299

iPad - 0x129a

iPhone 4 -

iPod touch 4G - 0x129e

Apple TV 2G -

+1
source share

All Articles