Get iPhone Device Name, Unique Device Identifier (UDID), OS and Model

The iPhone SDK includes a singleton of class type UIDevice that you can use to retrieve device specific information (this works equally as well with the simulator).

Available Properties in UIDevice
  • uniqueIdentifier – identifier guaranteed to be unique for every device
  • name – arbitrary name found in General > About setting on device
  • systemName – name of the OS running on the device
  • systemVersion – current version of the OS
  • model- model, such as ”iPhone” or ”iPod touch”
  • localizedModel – same as above using a localized string

Stats for Simulator

This code will list all stats shown above:

NSLog(@"uniqueIdentifier: %@", [[UIDevice currentDevice] uniqueIdentifier]);
NSLog(@"name: %@", [[UIDevice currentDevice] name]);
NSLog(@"systemName: %@", [[UIDevice currentDevice] systemName]);
NSLog(@"systemVersion: %@", [[UIDevice currentDevice] systemVersion]);
NSLog(@"model: %@", [[UIDevice currentDevice] model]);
NSLog(@"localizedModel: %@", [[UIDevice currentDevice] localizedModel]);

Running the above on the simulator returns:

Stats for iPhone

The device stats when running on my iPhone:


you can get the device model, like iPhone2,1 by using sysctlbyname(), Erica Sadun had a writeup about this at

the platform method below will give you @”iPhone2,1″ or whatever the device is

– (NSString *) getSysInfoByName:(char *)typeSpecifier
size_t size;
sysctlbyname(typeSpecifier, NULL, &size, NULL, 0);
char *answer = malloc(size);
sysctlbyname(typeSpecifier, answer, &size, NULL, 0);
NSString *results = [NSString stringWithCString:answer encoding: NSUTF8StringEncoding];
return results;

– (NSString *) platform
return [self getSysInfoByName:”hw.machine”];

by Brent Priddy on Dec 17, 2009. #

Is there a way to retrieve the model type, such as 3G, 3GS and 4? I mainly need to know if the device is a 3 or 4 (G or GS isn’t necessary, but would be useful).

by RRogers on Jul 29, 2010. #

The post below shows how to get the device type;

Determine Device Type – 3G or 3GS / iPod First or Second Generation

by John Muchow on Jul 29, 2010. #

Unfortunately it is deprecated in iOS5.

by Cesare on Nov 15, 2011. #

I wrote about an alternative here that may be an option for a unique identifier: Determine MAC Address not that the UDID is deprecated.

by John Muchow on Nov 15, 2011. #

Using UIDevice, many application developers will create their application privacy setting to download and update new version.

by Ryan Lawrence on Apr 5, 2012. #