iOS Specific device model:
#include <sys/types.h><sys/sysctl.h>
- (void) Test {//phone model. size_t size; Sysctlbyname ("Hw.machine", NULL, &size, NULL,0); Char*machine = (Char*) malloc (size); Sysctlbyname ("Hw.machine", machine, &size, NULL,0); NSString*platform =[NSString stringwithcstring:machine encoding:nsutf8stringencoding]; NSLog (@"%@", platform); //the platform you get here 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"; //Note: The emulator runs on the different}
Uidevice: Get Phone properties
- (void) Device {//[[Uidevice Currentdevice] systemName];//System name//[[Uidevice Currentdevice] systemversion];//Version number//[[Uidevice Currentdevice] model];//type, simulator, real machine//[[Uidevice Currentdevice] name];//Device Name//[[Uidevice Currentdevice] localizedmodel];//Local mode//access to equipment-related informationNSString *strname =[[Uidevice Currentdevice] name]; NSLog (@"device Name:%@", strName);//e.g. "My IPhone"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}
NSBundle: Get the app name version number
- (void) Bundle {//access to App-related informationNsdictionary *dicinfo =[[NSBundle Mainbundle] infodictionary]; //cfshow (dicinfo);NSString*strappname = [Dicinfo objectforkey:@"Cfbundledisplayname"]; NSLog (@"app Name:%@", strappname);//Current app nameNSString*strappversion = [Dicinfo objectforkey:@"cfbundleshortversionstring"]; NSLog (@"app version:%@", strappversion);//Current application version such as: 1.0.1NSString*strappbuild = [Dicinfo objectforkey:@"cfbundleversion"]; NSLog (@"App build version:%@", Strappbuild);//Current app version number int type}
Nslocale: Get machine Current language and country
-(void) locale { //Getting The User ' s Language nsarray *languagearray = [Nslocale preferredlanguages]; *language = [Languagearray objectatindex:0]; NSLog (@ " language:%@", language); *locale = [Nslocale Currentlocale]; *country = [locale localeidentifier]; NSLog (@ " Country:%@", Country);}
iOS get phone-related information