Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

/\/\

macrumors regular
Original poster
Sep 29, 2007
130
0
Germany
Hi I searched a complete "model id"-list of iOS devices in the forum, but I did not found anything.

Here is my function to get the model id of my iOS device:

Code:
+ (NSString *) deviceName
{
    struct utsname systemInfo;
    uname(&systemInfo);
    
    return [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding];
}

And here is my list of iOS devices:

Code:
     iPhone1,1  iPhone
     iPhone1,2  iPhone 3G
     iPhone2,1  iPhone 3GS
     iPhone3,1  iPhone 4 (AT&T)
     iPhone3,2  iPhone 4 (Verizon)
     iPhone4,1  iPhone 5 (not sure)
     iPhone4,2  iPhone 5 (not sure)
     
     iPad1,1    iPad
     iPad2,1    iPad2 (not sure)
     iPad2,2    iPad2 (not sure)
     iPad2,3    iPad2 (not sure)

Please can someone confirm / complete this list? (iPod touch devices are missing)

Thanks in advance.

Marcus
 

balamw

Moderator emeritus
Aug 16, 2005
19,366
979
New England

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
May I ask why you care? If you maintain such a table in your code it is basically guaranteed to be out of date when a new device comes along. If you need model breakdown, just use the "iDeviceX,Y" designation you can already retrieve.

Exactly. The APIs provide mechanisms to query the device from most of the capabilities you need (cameras, GPS etc) so lookups like this should not be needed.
 

balamw

Moderator emeritus
Aug 16, 2005
19,366
979
New England
Exactly. The APIs provide mechanisms to query the device from most of the capabilities you need (cameras, GPS etc) so lookups like this should not be needed.

This is a very OOP-y way of looking at it which is worth understanding.

I'm running on some device? Does that device have the property of a front facing camera? If so do something, if not do something else.

If it's strictly to get a breakdown just store the raw string you can already get.

B
 

/\/\

macrumors regular
Original poster
Sep 29, 2007
130
0
Germany
Currently I need this function deviceName to know if it's an iPad or an iPhone with retina display:

Code:
+ (BOOL) isIPAD
{
    NSString *device    = [self deviceName];
    
    if ([device rangeOfString:@"iPad"].location != NSNotFound)
    {
        NSLog(@"is iPad = YES");
        
        return YES;
    }
    else
    {
        NSLog(@"is iPad = NO");
        
        return NO;
    }
}

+ (BOOL) isIPHONE_WITH_RETINA_DISPLAY
{
    NSString *device    = [self deviceName];
    
    if ([device rangeOfString:@"iPhone3"].location != NSNotFound)
    {
        NSLog(@"RETINA DISPLAY = YES");
        
        return YES;
    }
    else if ([device rangeOfString:@"iPhone4"].location != NSNotFound)
    {
        NSLog(@"RETINA DISPLAY = YES");
        
        return YES;
    }
    else
    {
        NSLog(@"RETINA DISPLAY = NO");
        
        return NO;
    }
}

I found other functions for getting this information about the retina display. They used scale or something, but I think my functions are very straightforward.

Yes you are right, this is maybe a little bit outdated when a new device will be available, but I think everybody should update the own code for the new device.
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
Code:
+ (BOOL) isIPAD
{
  return UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad;
}

I'm pretty sure there is a similar, Apple provided, correct way to find out if the display is "retinal" or not. The way you're doing it is brittle and, frankly, a poor design and programming decision.
 

PhoneyDeveloper

macrumors 68040
Sep 2, 2008
3,114
93
What happens when they release the iPod Touch 39 or iPad 14 or the iSuperSecretNewDevice 1 or iPhone 5 with retina display? What about a device that Apple hasn't yet released to the public? Check the scale property. That's the way to do it.

There are occasionally features or behaviors or bug fixes that don't have a good way to check for their presence. But these two aren't that. There are standard suggested ways to check for iPad and Retina display so just use them.
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.