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