1. Get device information
NSLog (@"device Name:%@", [[Uidevice Currentdevice] systemName]); NSLog (@"version number:%@", [[Uidevice Currentdevice] systemversion]); NSLog (@"device Name:%@", [[Uidevice Currentdevice] name]; NSLog (@"Device mode:%@", [[Uidevice Currentdevice] model]); NSLog (@"Local Device mode:%@", [[Uidevice Currentdevice] localizedmodel]); NSLog (@"uniquely identifies%@", [[Uidevice Currentdevice] Identifierforvendor]. uuidstring); NSLog (@"%d", [[Uidevice Currentdevice] orientation]);
Uidevice provides a variety of properties, class functions, and status notifications to help us understand the state of the device in all directions.
From detecting battery power to locating devices and proximity sensing, Uidevice's job is to provide users and devices with some information about the application.
The Uidevice class is also capable of collecting specific details about the device, such as the model and iOS version.
Most of these properties have a positive effect on development efforts. The following code simply uses Uidevice to get phone properties
2. Get app Info
Nsdictionary *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
A bundle is a directory that contains the resources that the program will use. These resources include like, sound, compiled code, NIB files (the user will also refer to bundles as plug-in). The corresponding BUNDLE,COCOA provides class NSBundle.
An application looks no different from other files. But it's actually a directory that contains nib files, compiled code, and other resources. We call this directory the program's main bundle. This path allows you to get information about your app, such as the app name, version number, and so on.
3. Localization information
NSLog (@"---%@", Nslocaleidentifier); //Getting The User ' s LanguageNsarray *languagearray =[Nslocale preferredlanguages]; NSString*language = [Languagearray objectatindex:0]; NSLog (@"Language:%@", language);//enNslocale*locale =[Nslocale Currentlocale]; NSString*country =[locale Localeidentifier]; NSLog (@"Country:%@", country);//en_US
Nslocale can obtain the user's localization information settings, such as currency type, country, language, number, format of date format, provide correct geographical location display and so on. The following code gets the machine's current language and country code.
Basic App Info