IOS Device Information

Source: Internet
Author: User

In iOS development, sometimes we need to use some device-related information, the following is a detailed description of device-related information:

1. Get the current device owner name:



2. Get the category of the device, whether it's iphone,ipod or ipad


Here to get the specific type of iphone, you should have the following code:

-(NSString *) devicestring {//requires #import "sys/utsname.h" struct utsname systeminfo;        Uname (&systeminfo);        NSString *devicestring = [NSString stringWithCString:systeminfo.machine encoding:nsutf8stringencoding];    iphone if ([devicestring isequaltostring:@ "iphone1,1"]) return @ "iphone 1G";    if ([devicestring isequaltostring:@ "iphone1,2"]) return @ "IPhone 3G";    if ([devicestring isequaltostring:@ "iphone2,1"]) return @ "IPhone 3GS";    if ([devicestring isequaltostring:@ "iphone3,1"]) return @ "IPhone 4";    if ([devicestring isequaltostring:@ "iphone3,2"]) return @ "Verizon IPhone 4";        if ([devicestring isequaltostring:@ "iphone4,1"]) return @ "IPhone 4S";    if ([devicestring isequaltostring:@ "iphone5,1"]) return @ "IPhone 5";    if ([devicestring isequaltostring:@ "iphone5,2"]) return @ "IPhone 5";    if ([devicestring isequaltostring:@ "iphone5,3"]) return @ "IPhone 5C";        if ([devicestring isequaltostring:@ "iphone5,4"]) return @ "IPhone 5C"; if ([DeviCestring isequaltostring:@ "iphone6,1"]) return @ "IPhone 5S";        if ([devicestring isequaltostring:@ "iphone6,2"]) return @ "IPhone 5S";    if ([devicestring isequaltostring:@ "iphone7,1"]) return @ "IPhone 6 Plus";        if ([devicestring isequaltostring:@ "iphone7,2"]) return @ "IPhone 6";    if ([devicestring isequaltostring:@ "iphone8,1"]) return @ "IPhone 6s";            if ([devicestring isequaltostring:@ "iphone8,2"]) return @ "IPhone 6s Plus";    ipod if ([devicestring isequaltostring:@ "ipod1,1"]) return @ "ipod Touch 1G";    if ([devicestring isequaltostring:@ "ipod2,1"]) return @ "IPod Touch 2G";    if ([devicestring isequaltostring:@ "ipod3,1"]) return @ "IPod Touch 3G";    if ([devicestring isequaltostring:@ "ipod4,1"]) return @ "IPod Touch 4G";    if ([devicestring isequaltostring:@ "ipod5,1"]) return @ "IPod Touch 5G"; return nil;}

3. Device Localization Category:



4. Get the device's UUID:



5. Get the current phone running system and the current system version



The results are as follows:



Sometimes we also need to get information about the current app, such as the current app name, the current version number, to determine if the user should be prompted to upgrade the app.

The code is as follows:


IOS Device Information

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.