[IOS] Get device specific model information

Source: Internet
Author: User

Address of this article; http://blog.csdn.net/zhaoyabei/article/details/46697859
Application statistics sometimes need to upload the device model, if this write:

[[UIDevice currentDevice] model]

The acquired device model is not a specific model, such as running on iphone5s, measured to get the string @ "IPhone", I want a specific model.
Here is a way to get the device specific model (version and model of the corresponding relationship from Wikipedia):

- (NSString*) platform{structUtsname SystemInfo; Uname (&systeminfo);NSString*devicestring = [NSStringStringwithcstring:systeminfo. MachineEncoding:nsutf8stringencoding];//Do not consider older devices such as iPhone3 and do not consider ipad devices (the company's app does not support ipad)    if([Devicestring hasprefix:@"IPhone3"])return@"IPhone 4";if([Devicestring isequaltostring:@"iphone4,1"])return@"IPhone 4S";if([Devicestring isequaltostring:@"iphone5,1"]|| [Devicestring isequaltostring:@"iphone5,2"])return@"IPhone 5";if([Devicestring isequaltostring:@"iphone5,3"]|| [Devicestring isequaltostring:@"iphone5,4"])return@"IPhone 5C";if([Devicestring hasprefix:@"IPhone6"])return@"IPhone 5S";if([Devicestring isequaltostring:@"iphone7,1"])return@"IPhone 6 Plus";if([Devicestring isequaltostring:@"iphone7,2"])return@"IPhone 6";if([Devicestring isequaltostring:@"i386"])return@"Simulator";if([Devicestring isequaltostring:@"x86_64"])return@"Simulator";//If there is no matching direct return system offering similar @ "iphone5,3" This model    returndevicestring;}

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

[IOS] Get device specific model information

Related Article

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.