Code:
//Add header file#import<sys/utsname.h>-(void) viewdidload {[Super viewdidload]; //additional setup after loading the view, typically from a nib.NSLog (@"--self-machine-%@", [self machinename]);}#pragma-mark-functions//Get device Model-(nsstring*) machinename{structUtsname SystemInfo; Uname (&systemInfo); NSString*result =[NSString stringWithCString:systemInfo.machine encoding:nsutf8stringencoding ]; returnresult;}/*@ ' i386 ' on the simulator @ ' ipod1,1 ' on ipod touch @ ' ipod2,1 ' on ipod touch Second Generation @ ' ipod3,1 ' on ipod Touch Third Generation @ "ipod4,1" on ipod touch Fourth Generation @ "ipod5,1" on ipod touch Fifth Generation @ "IP hone1,1 ' on iphone @ ' iphone1,2 ' on iphone 3G @ ' iphone2,1 ' on iphone 3GS @ ' ipad1,1 ' on ipad @ ' ipad2,1 ' on ipad 2 @ "ipad 3,1 "on 3rd Generation ipad @" ipad3,2 ": on ipad 3 (GSM+CDMA) @ ' ipad3,3 ': on ipad 3 (GSM) @ ' ipad3,4 ': on ipad 4 (WiFi) @" ipad3,5 ": On ipad 4 (GSM) @ ' ipad3,6 ': on ipad 4 (GSM+CDMA) @ ' iphone3,1 ' on iphone 4 @ ' iphone4,1 ' on iphone 4S @" iphone5,1 " On iphone 5 @ ' ipad3,4 ' on 4th Generation ipad @ ' ipad2,5 ' on ipad Mini @ ' iphone5,1 ' on iphone 5 (GSM) @ ' iphone5,2 ' on I Phone 5 (GSM+CDMA) @ "iphone5,3 on iphone 5c (GSM) @" iphone5,4 "on iphone 5c (GSM+CDMA) @" iphone6,1 "on iphone 5s (GSM) @" IPhO ne6,2 "on IPhone 5s (GSM+CDMA)*/
Get device model number