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:

  1. 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”];

  2. 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).

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

Comments are closed.