What's the device code (platform string) for iPhone 5 / 5c / 5s / iPod touch 5?
Asked Answered
S

9

22

For example, is it "iPhone5,1" or "iPhone5,2" for iPhone 5? And what's the difference?

If anyone has the iPhone 5, please help by running the following code and showing your result. Thank you.

Related Link: https://mcmap.net/q/44813/-determine-device-iphone-ipod-touch-with-ios

Scavenger answered 20/9, 2012 at 2:38 Comment(4)
I have recorded user log since Sept. 12, and it seems that iPhone5,2 is more popular than iPhone5,1.Scavenger
For iPhone 5S & 5C platform string, see this post #18854744Swanherd
for iphone 6 and iphone 6 plus code is: iPhone7,2 and iPhone7,1Connally
detect all apple known devices using this answer "#25780783"Mannino
M
35

You can find a list of all iOS device identifiers here (including iPhone 5 models and iPad mini): http://theiphonewiki.com/wiki/index.php?title=Models

The identifiers of the latest models are:

iPhone 5: iPhone5,1 and iPhone5,2

iPhone 5C: iPhone5,3 and iPhone5,4

iPhone 5S: iPhone6,1 and iPhone6,2

iPhone 6: iPhone7,2

iPhone 6 Plus: iPhone7,1

iPhone 6S: iPhone8,1

iPhone 6S Plus: iPhone8,2

iPhone SE: iPhone8,4

iPhone 7: iPhone9,1 and iPhone9,3

iPhone 7 Plus: iPhone9,2 and iPhone9,4

iPhone 8: iPhone10,1 and iPhone10,4

iPhone 8 Plus: iPhone10,2 and iPhone10,5

iPhone X: iPhone10,3 and iPhone10,6

EDIT: I also made an updated version of the popular iOS Support Matrix including all models up to iPhone X.

Modality answered 5/11, 2012 at 13:50 Comment(2)
Link-only answers should always provide the critical information in the answer in case the link goes dead.Thrush
Fair enough. I've added the identifiers to the answer.Modality
A
28
if ([platform isEqualToString:@"iPhone1,1"])    return @"iPhone 2G";
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:@"iPhone3,2"])    return @"iPhone 4";
if ([platform isEqualToString:@"iPhone3,3"])    return @"iPhone 4 (CDMA)";
if ([platform isEqualToString:@"iPhone4,1"])    return @"iPhone 4S";
if ([platform isEqualToString:@"iPhone5,1"])    return @"iPhone 5";
if ([platform isEqualToString:@"iPhone5,2"])    return @"iPhone 5 (GSM+CDMA)";
if ([platform isEqualToString:@"iPhone5,3"])    return @"iPhone 5c (GSM+CDMA)";
if ([platform isEqualToString:@"iPhone5,4"])    return @"iPhone 5c (UK+Europe+Asia+China)";
if ([platform isEqualToString:@"iPhone6,1"])    return @"iPhone 5s (GSM+CDMA)";
if ([platform isEqualToString:@"iPhone6,2"])    return @"iPhone 5s (UK+Europe+Asia+China)";
if ([platform isEqualToString:@"iPhone7,1"])    return @"iPhone 6 Plus";
if ([platform isEqualToString:@"iPhone7,2"])    return @"iPhone 6";

if ([platform isEqualToString:@"iPod1,1"])      return @"iPod Touch (1 Gen)";
if ([platform isEqualToString:@"iPod2,1"])      return @"iPod Touch (2 Gen)";
if ([platform isEqualToString:@"iPod3,1"])      return @"iPod Touch (3 Gen)";
if ([platform isEqualToString:@"iPod4,1"])      return @"iPod Touch (4 Gen)";
if ([platform isEqualToString:@"iPod5,1"])      return @"iPod Touch (5 Gen)";
if ([platform isEqualToString:@"iPod7,1"])      return @"iPod Touch (6 Gen)";

if ([platform isEqualToString:@"iPad1,1"])      return @"iPad";
if ([platform isEqualToString:@"iPad1,2"])      return @"iPad 3G";
if ([platform isEqualToString:@"iPad2,1"])      return @"iPad 2 (WiFi)";
if ([platform isEqualToString:@"iPad2,2"])      return @"iPad 2";
if ([platform isEqualToString:@"iPad2,3"])      return @"iPad 2 (CDMA)";
if ([platform isEqualToString:@"iPad2,4"])      return @"iPad 2";
if ([platform isEqualToString:@"iPad2,5"])      return @"iPad Mini (WiFi)";
if ([platform isEqualToString:@"iPad2,6"])      return @"iPad Mini";
if ([platform isEqualToString:@"iPad2,7"])      return @"iPad Mini (GSM+CDMA)";
if ([platform isEqualToString:@"iPad3,1"])      return @"iPad 3 (WiFi)";
if ([platform isEqualToString:@"iPad3,2"])      return @"iPad 3 (GSM+CDMA)";
if ([platform isEqualToString:@"iPad3,3"])      return @"iPad 3";
if ([platform isEqualToString:@"iPad3,4"])      return @"iPad 4 (WiFi)";
if ([platform isEqualToString:@"iPad3,5"])      return @"iPad 4";
if ([platform isEqualToString:@"iPad3,6"])      return @"iPad 4 (GSM+CDMA)";
if ([platform isEqualToString:@"iPad4,1"])      return @"iPad Air (WiFi)";
if ([platform isEqualToString:@"iPad4,2"])      return @"iPad Air (GSM+CDMA)";
if ([platform isEqualToString:@"iPad4,4"])      return @"iPad Mini 2 (WiFi)";
if ([platform isEqualToString:@"iPad4,5"])      return @"iPad Mini 2 (GSM+CDMA)";
if ([platform isEqualToString:@"iPad4,6"])      return @"iPad Mini 2 (China)";
if ([platform isEqualToString:@"iPad4,7"])      return @"iPad Mini 3 (WiFi)";
if ([platform isEqualToString:@"iPad4,8"])      return @"iPad Mini 3 (GSM+CDMA)";
if ([platform isEqualToString:@"iPad4,9"])      return @"iPad Mini 3 (China)";
if ([platform isEqualToString:@"iPad5,3"])      return @"iPad Air 2 (WiFi)";
if ([platform isEqualToString:@"iPad5,4"])      return @"iPad Air 2";

if ([platform isEqualToString:@"i386"])         return @"Simulator";
if ([platform isEqualToString:@"x86_64"])       return @"Simulator";

return platform;  
Anyaanyah answered 14/11, 2013 at 20:45 Comment(4)
Is there a source for this on github or similar so I can suck this in and not have to find and update every time a release happens?Illyrian
Asis? Do you mean Asia?Bootie
Note the harmless repeated iPad3.6. I do this with static NSDictionary* deviceNames; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ deviceNames = @{ @"i386" : @"iPhone Simulator", @"x86_64" : @"iPhone Simulator", ... and NSString* readableName = (NSString*)deviceNames[machineName];Misery
for iphone 6 and iphone 6 plus code is: iPhone7,2 and iPhone7,1Connally
P
11

This method covers all devices in market:

- (NSString *) platform{
int mib[2];
size_t len;
char *machine;

mib[0] = CTL_HW;
mib[1] = HW_MACHINE;
sysctl(mib, 2, NULL, &len, NULL, 0);
machine = malloc(len);
sysctl(mib, 2, machine, &len, NULL, 0);

NSString *platform = [NSString stringWithCString:machine encoding:NSASCIIStringEncoding];
free(machine);
return platform; }

- (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:@"iPhone3,3"])    return @"Verizon iPhone 4";
if ([platform isEqualToString:@"iPhone4,1"])    return @"iPhone 4S";
if ([platform isEqualToString:@"iPhone5,1"])    return @"iPhone 5 (GSM)";
if ([platform isEqualToString:@"iPhone5,2"])    return @"iPhone 5 (GSM+CDMA)";
if ([platform isEqualToString:@"iPhone5,3"])    return @"iPhone 5c (GSM+CDMA)";
if ([platform isEqualToString:@"iPhone5,4"])    return @"iPhone 5c (UK+Europe+Asia+China)";
if ([platform isEqualToString:@"iPhone6,1"])    return @"iPhone 5s (GSM+CDMA)";
if ([platform isEqualToString:@"iPhone6,2"])    return @"iPhone 5s (UK+Europe+Asia+China)";
if ([platform isEqualToString:@"iPhone7,1"])    return @"iPhone 6 Plus";
if ([platform isEqualToString:@"iPhone7,2"])    return @"iPhone 6";
if ([platform isEqualToString:@"iPhone8,1"])    return @"iPhone 6s";
if ([platform isEqualToString:@"iPhone8,2"])    return @"iPhone 6s Plus";
if ([platform isEqualToString:@"iPhone8,4"])    return @"iPhone SE";
if ([platform isEqualToString:@"iPhone9,1"])    return @"iPhone 7";
if ([platform isEqualToString:@"iPhone9,2"])    return @"iPhone 7 Plus";
if ([platform isEqualToString:@"iPhone9,3"])    return @"iPhone 7";
if ([platform isEqualToString:@"iPhone9,4"])    return @"iPhone 7 Plus";


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:@"iPod5,1"])      return @"iPod Touch 5G";

if ([platform isEqualToString:@"iPad1,1"])      return @"iPad";
if ([platform isEqualToString:@"iPad1,2"])      return @"iPad 3G";
if ([platform isEqualToString:@"iPad2,1"])      return @"iPad 2 (WiFi)";
if ([platform isEqualToString:@"iPad2,2"])      return @"iPad 2";
if ([platform isEqualToString:@"iPad2,3"])      return @"iPad 2 (CDMA)";
if ([platform isEqualToString:@"iPad2,4"])      return @"iPad 2";
if ([platform isEqualToString:@"iPad2,5"])      return @"iPad Mini (WiFi)";
if ([platform isEqualToString:@"iPad2,6"])      return @"iPad Mini";
if ([platform isEqualToString:@"iPad2,7"])      return @"iPad Mini (GSM+CDMA)";
if ([platform isEqualToString:@"iPad3,1"])      return @"iPad 3 (WiFi)";
if ([platform isEqualToString:@"iPad3,2"])      return @"iPad 3 (GSM+CDMA)";
if ([platform isEqualToString:@"iPad3,3"])      return @"iPad 3";
if ([platform isEqualToString:@"iPad3,4"])      return @"iPad 4 (WiFi)";
if ([platform isEqualToString:@"iPad3,5"])      return @"iPad 4";
if ([platform isEqualToString:@"iPad3,6"])      return @"iPad 4 (GSM+CDMA)";
if ([platform isEqualToString:@"iPad4,1"])      return @"iPad Air (WiFi)";
if ([platform isEqualToString:@"iPad4,2"])      return @"iPad Air (Cellular)";
if ([platform isEqualToString:@"iPad4,4"])      return @"iPad Mini 2 (WiFi)";
if ([platform isEqualToString:@"iPad4,5"])      return @"iPad Mini 2 (Cellular)";
if ([platform isEqualToString:@"iPad4,6"])      return @"iPad Mini 2";
if ([platform isEqualToString:@"iPad4,7"])      return @"iPad Mini 3";
if ([platform isEqualToString:@"iPad4,8"])      return @"iPad Mini 3";
if ([platform isEqualToString:@"iPad4,9"])      return @"iPad Mini 3";
if ([platform isEqualToString:@"iPad5,3"])      return @"iPad Air 2";
if ([platform isEqualToString:@"iPad5,4"])      return @"iPad Air 2";


if ([platform isEqualToString:@"i386"])         return @"Simulator";
if ([platform isEqualToString:@"x86_64"])       return @"Simulator";
return platform; }
Paralyse answered 23/6, 2013 at 13:11 Comment(2)
for iphone 6 and iphone 6 plus code is: iPhone7,2 and iPhone7,1Connally
Are you sure that this is what the code reflect? In previous models for example iPhone 5 the 6,1 & 6,2 where the iPhone 5 but with GSM and GSM+CDMA.Hundredfold
F
4

Yup, "iPhone5,1" is the GSM iPhone 5, "iPhone5,2" is the CDMA iPhone 5, "iPhone5,3" is the GSM iPhone 5C, "iPhone5,4" is the CDMA iPhone 5C, "iPhone6,1" is the GSM iPhone 5S, and "iPhone6,2" is the CDMA iPhone 5S. Does that answer your question?

Fighterbomber answered 23/9, 2013 at 18:11 Comment(0)
A
3

The Verizon iPhone 5 returns "iPhone5,2". The GSM phone returns "iPhone5,1".

Astigmia answered 21/9, 2012 at 17:43 Comment(0)
G
3

It looks like either iPhone5,1 or iPhone5,2 depending on the model of iPhone 5.

From @marcoarment, who is a well known iOS Developer:

iPhone5,1: model A1428, AT&T/Canada

iPhone5,2: model A1429, all others

A1429 may have two modes, but I don’t see any iPhone5,3 records.

Source: https://twitter.com/marcoarment/status/249249183029161984

Goon answered 21/9, 2012 at 22:25 Comment(0)
C
1

I created a library for detecting the device at runtime.

It's called SDVersion.

Thought some may found it useful.

Clod answered 26/8, 2015 at 22:50 Comment(0)
V
1

[Update]
iPhone10,1 : iPhone 8
iPhone10,2 : iPhone 8 Plus
iPhone10,3 : iPhone X Global
iPhone10,4 : iPhone 8
iPhone10,5 : iPhone 8 Plus
iPhone10,6 : iPhone X GSM
iPhone11,2 : iPhone XS
iPhone11,4 : iPhone XS Max
iPhone11,6 : iPhone XS Max Global
iPhone11,8 : iPhone XR
iPhone12,1 : iPhone 11
iPhone12,3 : iPhone 11 Pro
iPhone12,5 : iPhone 11 Pro Max
iPhone12,8 : iPhone SE 2nd Gen

Vasiliu answered 3/10, 2017 at 5:6 Comment(0)
J
0

check out your answer over here How to detect iPhone 5 (widescreen devices)?. till now i have not found any answer until some one developer buy iPhone 5 and post some useful information

Jesselton answered 20/9, 2012 at 5:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.