"iOS Dev-2" info.plist file: How to add and subtract configurations and how to call values inside the code

Source: Internet
Author: User

The Info.plist file is actually similar to a system configuration file, where you can set the system system language, the program version and whether the state is hidden from reality and so on. We generally open the info.plist is viewed in the form of a property list, of course you can also right-click on the file Select Open As>>>source code opened in XML form.


(1) How to add and delete a Info.plist project?

Where you want to add, right click on >>>add row, you can drop down to view the selection or enter the name directly, then enter the variable later.


To delete, select a bar, have + and-, click the minus sign-you can.



(2) How do I call the value in Info.plist in the code?

In the following function of the APPDELEGATE.M file, enter:

-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (Nsdictionary *) launchOptions {    Nsdictionary *dic1=[[nsbundle mainbundle]infodictionary];    NSLog (@ "%@", [Dic1 objectforkey:@ "cfbundleversion"]);    Override point for customization after application launch.    return YES;}
Where this info.plist file is a dictionary, we need to create a dictionary to accept the data and then use the key value key to get the value.

In this case, the version information (cfbundleversion) was obtained and the result was 1.0.

"iOS Dev-2" info.plist file: How to add and subtract configurations and how to call values inside the code

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.