iPhone / iOS get device model

Mit diesem kleine Code sniped kann die aktuelle Version des genutzten iPhone / iPod / iPad bestimmt werden.

#import <sys/utsname.h>

struct utsname u;
uname(&u);

NSString *name =  [NSString stringWithCString:u.machine encoding:NSUTF8StringEncoding];

NSArray *oldDevices = @[@"iPhone1,1", @"iPhone1,2", @"iPhone2,1", @"iPhone3,1", @"iPhone3,2", @"iPhone3,3", @"iPod1,1", @"iPod2,1", @"iPod2,2", @"iPod3,1"];

if ([oldDevices containsObject:name])
{
    // Workaround for old devices
}
else
{

}