iOS development, get iOS device model

Source: Internet
Author: User

1, first to import the header file #import <sys/utsname.h> 2, code as follows  -(NSString *) getdeviceversioninfo{    struct Utsname systeminfo;    uname (&systeminfo);    NSString *platform = [NSString stringwithformat:@ "%s", systeminfo.machine];   //   //back   IPhone iPod ipad   //    NSString *devicetype = [[Uidevice currentdevice] model];    return platform;}  -(NSString *) correspondversion {    NSString *correspondversion = [Self getdeviceversioninfo];  & nbsp if ([Correspondversion isequaltostring:@ "i386"])           [email protected] "Simulator";     if ([Correspondversion isequaltostring:@ "x86_64"])       return @ "Simulator";    if ([Correspondversion isequaltostring:@ "iphone1,1"])    [email protected] "IPhone 1";    if ( [Correspondversion isequaltostring:@ "iphone1,2"])    [email protected] "IPHone 3 ";    if ([Correspondversion isequaltostring:@" iphone2,1 "])    [email protected]" IPhone 3S ";    if ([Correspondversion isequaltostring:@" iphone3,1 "] | | [Correspondversion isequaltostring:@ "iphone3,2"])        [email protected] "IPhone 4";    if ([Correspondversion isequaltostring:@ " iphone4,1 "])    [email protected]" IPhone 4S ";    if ([Correspondversion isequaltostring:@" iphone5,1 "] | | [Correspondversion isequaltostring:@ "iphone5,2"])    return @ "IPhone 5";    if ([Correspondversion isequaltostring:@ "iphone5,3"] | | [Correspondversion isequaltostring:@ "iphone5,4"])    return @ "IPhone 5C";    if ([Correspondversion isequaltostring:@ "iphone6,1"] | | [Correspondversion isequaltostring:@ "iphone6,2"])    return @ "IPhone 5S";    if ([Correspondversion isequaltostring:@ "iphone7,1"])  return @ " IPhone 6 ";    if ([correspondversionisequaltostring:@ "iphone7,2"])  return @ "IPhone 6 Plus";    if ([Correspondversion isequaltostring:@ " iphone8,1 "])  return @" IPhone 6s ";    if ([Correspondversion isequaltostring:@" iphone8,2 "])   return @ "IPhone 6s Plus";    if ([Correspondversion isequaltostring:@ "iphone8,4"])   return @ "  IPhone SE ";  if ([Correspondversion isequaltostring:@ "iphone9,1"])     return @ "IPhone 7 (CDMA)"; if ([Correspondversion isequaltostring:@ "iphone9,3"])     return @ "IPhone 7 (GSM)";    if ([ Correspondversion isequaltostring:@ "iphone9,2"])     return @ "IPhone 7 Plus (CDMA)";    if ([ Correspondversion isequaltostring:@ "iphone9,4"])     return @ "IPhone 7 Plus (GSM)";      / /ipod    if ([Correspondversion isequaltostring:@ "ipod1,1"])       return @ "IPod Touch 1G";     if ([Correspondversion isequaltostring:@ "ipod2,1"])       return @ "ipod Touch 2G";    if ([Correspondversion isequaltostring:@ "ipod3,1"])       return @ "ipod Touc H 3G ";    if ([Correspondversion isequaltostring:@" ipod4,1 "])       return @" IPod Touch 4G "; &nbsp ;   if ([Correspondversion isequaltostring:@ "ipod5,1"])       return @ "IPod Touch 5G";   & nbsp ipad    if ([Correspondversion isequaltostring:@ "ipad1,1"])       return @ "IPad";    if ([Correspondversion isequaltostring:@ "ipad2,1"])       return @ "IPad 2 (WiFi)";    if ([ Correspondversion isequaltostring:@ "ipad2,2"])       return @ "IPad 2 (GSM)";    if ([ Correspondversion isequaltostring:@ "ipad2,3"])       return @ "IPad 2 (CDMA)";    if ([ Correspondversion isequaltostring:@ "ipad2,4"])       return @ "IPad 2 (32nm)";    if ([ Correspondversion isequaltostring:@ "ipad2,5")      return @ "IPad Mini (WiFi)";    if ([Correspondversion isequaltostring:@ "ipad2,6"])       return @ "ipad Mini (GSM)";    if ([Correspondversion isequaltostring:@ "ipad2,7"])       return @ "ipad min I (CDMA) ";    if ([Correspondversion isequaltostring:@" ipad3,1 "])       return @" IPad 3 (WiFi) "; nbsp   if ([Correspondversion isequaltostring:@ "ipad3,2"])       return @ "IPad 3 (CDMA)";    if ([ Correspondversion isequaltostring:@ "ipad3,3"])       return @ "IPad 3 (4G)";    if ([ Correspondversion isequaltostring:@ "ipad3,4"])       return @ "IPad 4 (WiFi)";    if ([ Correspondversion isequaltostring:@ "ipad3,5"])       return @ "IPad 4 (4G)";    if ([ Correspondversion isequaltostring:@ "ipad3,6"])       return @ "IPad 4 (CDMA)";    if ([ Correspondversion isequaltostring:@ "ipad4,1"])       return @ "ipad Air ";    if ([Correspondversion isequaltostring:@" ipad4,2 "])       return @" IPad Air ";     if ([Correspondversion isequaltostring:@ "ipad4,3"])       return @ "IPad Air";    IF ([Correspondversion isequaltostring:@ "ipad5,3"])       return @ "IPad Air 2";    if ([CORRESPONDV Ersion isequaltostring:@ "ipad5,4"])       return @ "IPad Air 2";    if ([Correspondversion isequal tostring:@ "i386"])          return @ "Simulator";    if ([correspondversion isequaltostring:@ "x86_64"])        return @ "Simulator";    if ([correspondversion isequaltostring:@ "ipad4,4"]| | [Correspondversion isequaltostring:@ "ipad4,5"]| | [Correspondversion isequaltostring:@ "ipad4,6"])       return @ "IPad Mini 2";    if ([Correspondversion isequaltostring:@ "ipad4,7"]| | [Correspondversion isequaltostring:@ "ipad4,8"]| | [Correspondversion isequaltostring:@ "ipad4,9"])       return @ "IPad Mini 3";    NSLog (@ "Your device type is:%@", correspondversion);    return correspondversion;}

In iOS development, get the iOS device model

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.