Before the second, add a content. Uidevice is not available for specific device models.
To get the device model, such as (iphone 4s, iphone5), this way.
1. Introduce the header file.
#include <sys/types.h>
#include <sys/sysctl.h>
< Span style= "FONT-SIZE:18PX; Color:rgb (255, 0, 0); " >2. Get model
//phone model. size_t size; sysctlbyname ("Hw.machine", NULL, &size, &NBSP;NULL,&NBSP;0); char *machine = (char*) malloc (size); Sysctlbyname ("Hw.machine", machine, &size, null, 0); nsstring *platform = [nsstring stringwithcstring : machine encoding:nsutf8stringencoding];
here to get the platform is a device model. Like iphone5,2.
So if you want to be more perfect, you can judge by the string yourself.
For example: if ([Platform isequaltostring:@ "iphone3,1"]) return @ "IPhone 4";
Acquisition of information about //equipment nsstring *strname = [[ Uidevice currentdevice] name]; nslog (@ "Device name:%@", strName);// e.g. "My iphone" nsstring *strid = [[uidevice currentdevice] uniqueidentifier]; nslog (@ "Device unique ID:%@", strId ); not available after//uuid,5.0 nsstring * strsysname = [[uidevice currentdevice] systemname]; NSLog (@ "system name:%@", strsysname);// e.g. @ "IOS" nsstring * strsysversion = [[uidevice currentdevice] systemversion]; nslog (@ "System version number:%@", strsysversion);// e.g. @ "4.0" nsstring *strmodel = [[uidevice currentdevice] model]; nslog (@ "Device mode:%@", strmodel),// e.g. @ "IPhone", @ "Ipod touch" NSString *strLocModel = [[UIDevice Currentdevice] localizedmodel]; nslog (@ "Local device mode:%@", strLocModel) ;// localized version of model //local model (internationalized region name) NSString* phoneModel = [[UIDevice Currentdevice] model]; nslog (@ "Phone model: %@",phoneModel ); //Phone Model
3.IOS get phone with screen properties