Get app information in the IOS program

Source: Internet
Author: User

iOS application, often use to some of the program itself parameter settings, so record a pen.

1 //Build Number2NSString *version = [[[NSBundle Mainbundle] infodictionary] Objectforkey:@"cfbundleversion"];3 //Version number4NSString *shortversion = [[[NSBundle Mainbundle] infodictionary] Objectforkey:@"cfbundleshortversionstring"];5 //Bundle ID6NSString *bundleid = [[[NSBundle Mainbundle] infodictionary] Objectforkey:@"Cfbundleidentifier"];

See here, seems to understand, in fact, the above key is the app inside the Info.plist some key. You can open the Info.plist file and get the corresponding key value according to your needs.

The following list is common:

1 //device Name: IPhone Simulator2NSString *strname =[[Uidevice Currentdevice] name];3NSLog (@"device Name:%@", strsysname);4 5 //system name: IPhone OS6NSString *strsysname =[[Uidevice Currentdevice] systemName];7NSLog (@"system name:%@", strsysname);8 9 //System version number: 9.2TenNSString *strsysversion =[[Uidevice Currentdevice] systemversion]; OneNSLog (@"System version number:%@", strsysversion); A  - //Device mode: IPhone -NSString *strmodel =[[Uidevice Currentdevice] model]; theNSLog (@"Device mode:%@", Strmodel); -  - //Local Device mode: IPhone -NSString *strlocmodel =[[Uidevice Currentdevice] localizedmodel]; +NSLog (@"Local Device mode:%@", Strlocmodel); -  + //Get user Language preferences A //language: En -US atNsarray *languagearray =[Nslocale preferredlanguages]; -NSString *language = [Languagearray objectatindex:0]; -  - //Country: en_US -Nslocale *locale =[Nslocale Currentlocale]; -NSString *country =[locale localeidentifier]; in  - //gets the unique identifier of the device to //468585ab-d694-46d0-a6e1-354714e8e23b +NSString *identifier = [[[Uidevice Currentdevice] Identifierforvendor] uuidstring];

Also includes the network type judgment, the battery power obtains and so on. But not commonly used, it is not included.

Get app information in the IOS program

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.