iOS get iphone phone device model

Source: Internet
Author: User

Iphone6plus and IPhone6 can also be obtained in magnification mode:

Import:

#import "Sys/utsname.h"

Call:

-(nsstring*) devicestring

{

Need #import "Sys/utsname.h"

struct Utsname systemInfo;

Uname (&systeminfo);

NSString *platform = [NSString stringWithCString:systemInfo.machine encoding:nsutf8stringencoding];

return platform;

}

Return:

if ([Platform isequaltostring:@ "iphone1,1"]) return @ "IPhone 2G";

if ([Platform isequaltostring:@ "iphone1,2"]) return @ "IPhone 3G";

if ([Platform isequaltostring:@ "iphone2,1"]) return @ "IPhone 3GS";

if ([Platform isequaltostring:@ "iphone3,1"]) return @ "IPhone 4";

if ([Platform isequaltostring:@ "iphone3,3"]) return @ "IPhone 4 (CDMA)";

if ([Platform isequaltostring:@ "iphone4,1"]) return @ "IPhone 4S";

if ([Platform isequaltostring:@ "iphone5,1"]) return @ "IPhone 5 (GSM)";

if ([Platform isequaltostring:@ "iphone5,2"]) return @ "IPhone 5 (CDMA)";

if ([Platform isequaltostring:@ "iphone5,3"]) return @ "IPhone 5C (GSM)";

if ([Platform isequaltostring:@ "iphone5,4"]) return @ "IPhone 5C (Global)";

if ([Platform isequaltostring:@ "iphone6,1"]) return @ "IPhone 5S (GSM)";

if ([Platform isequaltostring:@ "iphone6,2"]) return @ "IPhone 5S (Global)";

if ([Platform isequaltostring:@ "iphone7,1"]) return @ "IPhone 6 Plus";

if ([Platform isequaltostring:@ "iphone7,2"]) return @ "IPhone 6";

Ipod

if ([Platform isequaltostring:@ "ipod1,1"]) return @ "IPod Touch 1G";

if ([Platform isequaltostring:@ "ipod2,1"]) return @ "IPod Touch 2G";

if ([Platform isequaltostring:@ "ipod3,1"]) return @ "IPod Touch 3G";

if ([Platform isequaltostring:@ "ipod4,1"]) return @ "IPod Touch 4G";

if ([Platform isequaltostring:@ "ipod5,1"]) return @ "IPod Touch 5G";

Ipad

if ([Platform isequaltostring:@ "ipad1,1"]) return @ "IPad 1";

if ([Platform isequaltostring:@ "ipad2,1"]) return @ "IPad 2 (WiFi)";

if ([Platform isequaltostring:@ "ipad2,2"]) return @ "IPad 2 (GSM)";

if ([Platform isequaltostring:@ "ipad2,3"]) return @ "IPad 2 (CDMA)";

if ([Platform isequaltostring:@ "ipad2,4"]) return @ "IPad 2 (32nm)";

if ([Platform isequaltostring:@ "ipad2,5"]) return @ "IPad Mini (WiFi)";

if ([Platform isequaltostring:@ "ipad2,6"]) return @ "IPad Mini (GSM)";

if ([Platform isequaltostring:@ "ipad2,7"]) return @ "IPad Mini (CDMA)";

if ([Platform isequaltostring:@ "ipad3,1"]) return @ "IPad 3 (WiFi)";

if ([Platform isequaltostring:@ "ipad3,2"]) return @ "IPad 3 (CDMA)";

if ([Platform isequaltostring:@ "ipad3,3"]) return @ "IPad 3 (GSM)";

if ([Platform isequaltostring:@ "ipad3,4"]) return @ "IPad 4 (WiFi)";

if ([Platform isequaltostring:@ "ipad3,5"]) return @ "IPad 4 (GSM)";

if ([Platform isequaltostring:@ "ipad3,6"]) return @ "IPad 4 (CDMA)";

if ([Platform isequaltostring:@ "ipad4,1"]) return @ "IPad Air (WiFi)";

if ([Platform isequaltostring:@ "ipad4,2"]) return @ "IPad Air (Cellular)";

if ([Platform isequaltostring:@ "ipad4,3"]) return @ "IPad Air (China)";

if ([Platform isequaltostring:@ "ipad5,3"]) return @ "IPad Air 2 (WiFi)";

if ([Platform isequaltostring:@ "ipad5,4"]) return @ "IPad Air 2 (Cellular)";

IPad Mini

if ([Platform isequaltostring:@ "ipad4,4"]) return @ "IPad Mini 2 (WiFi)";

if ([Platform isequaltostring:@ "ipad4,5"]) return @ "IPad Mini 2 (Cellular)";

if ([Platform isequaltostring:@ "ipad4,6"]) return @ "IPad Mini 2 (China)";

if ([Platform isequaltostring:@ "ipad4,7"]) return @ "IPad Mini 3 (WiFi)";

if ([Platform isequaltostring:@ "ipad4,8"]) return @ "IPad Mini 3 (Cellular)";

if ([Platform isequaltostring:@ "ipad4,9"]) return @ "IPad Mini 3 (China)";

Simulator

if ([Platform isequaltostring:@ "i386"]) return @ "Simulator";

if ([Platform isequaltostring:@ "x86_64"]) return @ "Simulator";

iOS get iphone phone 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.