#import <sys/utsname.h>
struct utsname systemInfo;
uname(&systemInfo);
NSString *platform = [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding];
if ([platform isEqualToString:@"iPhone1,1"]) {
platform = @"iPhone2G";
}
else if ([platform isEqualToString:@"iPhone1,2"]) {
platform = @"iPhone3G";
}
else if ([platform isEqualToString:@"iPhone2,1"]) {
platform = @"iPhone3GS";
}
else if ([platform isEqualToString:@"iPhone3,1"]) {
platform = @"iPhone4";
}
else if ([platform isEqualToString:@"iPhone3,3"]) {
platform = @"iPhone4(CDMA)";
}
else if ([platform isEqualToString:@"iPhone4,1"]) {
platform = @"iPhone4S";
}
else if ([platform isEqualToString:@"iPod1,1"]) {
platform = @"iPod1G";
}
else if ([platform isEqualToString:@"iPod2,1"]) {
platform = @"iPod2G";
}
else if ([platform isEqualToString:@"iPod3,1"]) {
platform = @"iPod3G";
}
else if ([platform isEqualToString:@"iPod4,1"]) {
platform = @"iPod4G";
}
else if ([platform isEqualToString:@"iPad1,1"]) {
platform = @"iPad";
}
else if ([platform isEqualToString:@"iPad2,1"]) {
platform = @"iPad2(WiFi)";
}
else if ([platform isEqualToString:@"iPad2,2"]) {
platform = @"iPad2(GSM)";
}
else if ([platform isEqualToString:@"iPad2,3"]) {
platform = @"iPad2(CDMA)";
}
else if ([platform isEqualToString:@"iPad3,1"]) {
platform = @"iPad3(WiFi)";
}
else if ([platform isEqualToString:@"iPad3,2"]) {
platform = @"iPad3(GSM)";
}
else if ([platform isEqualToString:@"iPad3,3"]) {
platform = @"iPad3(CDMA)";
}
else if ([platform isEqualToString:@"i386"]) {
platform = @"Simulator";
}
else {
platform = @"unKnownDevice";
}