In development, it is necessary to obtain some information about the current device, which can be obtained through Uidevice,nsbundle,nslocale.
Uidevice
Uidevice provides a variety of properties, class functions and status notifications, which can detect cell phone power, positioning, sensing, model, current system version and so on.
Device-related information acquisition nsstring *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];
NSBundle
A bundle is a directory that contains the resources the program uses, including images, sounds, compiled code, and some application information.
/app application-related information acquisition nsdictionary *dicinfo = [[NSBundle mainbundle] infodictionary]; cfshow (dicinfo); NSString *strappname = [Dicinfo objectforkey:@ "Cfbundledisplayname"]; NSLog (@ "app app Name:%@", strappname); NSString *strappversion = [Dicinfo objectforkey:@ "cfbundleshortversionstring"]; NSLog (@ "app version:%@", strappversion); NSString *strappbuild = [Dicinfo objectforkey:@ "cfbundleversion"];
Nslocale
Nslocale can obtain the user's localization information, such as currency, language, country, number, date format, location display and so on.
1 //Getting The User ' s Language2Nsarray *languagearray =[Nslocale preferredlanguages]; 3NSString *language = [Languagearray objectatindex:0]; 4NSLog (@"Language:%@", language);//en5 6Nslocale *locale =[Nslocale Currentlocale]; 7NSString *country =[locale Localeidentifier]; 8NSLog (@"Country:%@", country);//en_US
iOS Development Get mobile info (Uidevice,nsbundle,nslocale)