Determine device (iPhone, iPod Touch) with iOS

Rob picture Rob · Jan 15, 2009 · Viewed 192.7k times · Source

Is there a way to determine the device running an application. I want to distinguish between iPhone and iPod Touch, if possible.

Answer

Adam Rosenfield picture Adam Rosenfield · Jan 15, 2009

You can use the UIDevice class like this:

NSString *deviceType = [UIDevice currentDevice].model;

if([deviceType isEqualToString:@"iPhone"])
    // it's an iPhone