Get device model, app information, System Information

Source: Internet
Author: User

First, there are three ways to obtain the device model:

===== Device Model: Method One ========

NSString * Strmodel  = [Uidevice currentdevice].model; NSLog (@ "model:%@", Strmodel); NSLog (@ "Localizedmodel:%@", [[Uidevice Currentdevice] localizedmodel]);

===== Device Model: Method Two =========

struct Utsname systeminfo;uname (&systeminfo); NSString *devicestring = [NSString stringWithCString:systemInfo.machine encoding:nsutf8stringencoding]; NSLog (@ "systeminfo.machine:%@", devicestring);

===== Device Model: Method three (model) =========

size_t size;sysctlbyname ("Hw.machine", NULL, &size, NULL, 0); char *model = (char *) malloc (size); Sysctlbyname ("hw.m Achine ", model, &size, NULL, 0); NSString * StrModel3 = [NSString Stringwithcstring:model encoding:nsutf8stringencoding];free (model); NSLog (@ "hw.machine-model:%@", strModel3);

===== Device Model: Method three (machine) =========

Char *machine = (char*) malloc (size), Sysctlbyname ("Hw.machine", Machine, &size, NULL, 0); NSString *platform = [NSString stringwithcstring:machine encoding:nsutf8stringencoding];free (machine); NSLog (@ "hw.machine-platform:%@", platform);

Get device model, app information, System 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.