IOS-Plist-V1.0

Source: Internet
Author: User

Plist files are standard XML files.

A). Write the plist file: (Dictionary/array)
Nsmutabledictionary * dict = [[nsmutabledictionary alloc] initwithcontentsoffile: @ "/sample. plist"];
[Dict setobject: @ "yes" forkey: @ "restartspringboard"];
[Dict writetofile: @ "/sample. plist" atomically: Yes];

B). Read the plist file:

// Read plist from the project and initialize dictionary.
Nsmutabledictionary * dict = [[nsmutabledictionary alloc] initwithcontentsoffile: @ "/sample. plist"];
Nsstring * object = [dict objectforkey: @ "restartspringboard"];

// Read the plist file in the directory to nsmutabledictionary.
Nsmutabledictionary * dictplist = [[nsmutabledictionary alloc] initwithcontentsofurl: [nsurl fileurlwithpath: path];

 

 

After creating a project, we will see a "project name-info. plist file, which is an important file for some runtime configuration of the project and cannot be deleted.

If the file name of the project you downloaded online is info. plist, congratulations, this project is too old. It was generated by xcode earlier than sdk2.0, but it does not matter and does not affect the use.

If you use a text editor to open this file, you will find that this is an XML text file. Generally, you do not need a text editor to directly edit this file, but use xcode to edit it.

The following is an example of this file:

The following describes the possible fields:

Localiztion Native Development Region --- cfbundledevelopmentregion is related to localization. If the user's location does not have the corresponding language resources, use the value of this key as the default value.

Bundle display name --- cfbundledisplayname specifies the name displayed after the program is installed. The Application name must be 10-12 characters long. If the application name is exceeded, the abbreviated name is displayed.

Executaule file -- Name of the installation package of the cfbundleexecutable Program

Icon file --- cfbundleiconfile application map name, which is generally icon.png

Bundle identifier --- cfbundleidentifier the unique identifier string of the bundle. The format of this string is similar to that of COM. yourcompany. yourapp: if you use a simulator to run your application, this field is useless. If you need to deploy your application to a device, you must generate a certificate. When you generate a certificate, you need to add the corresponding app IDs to your apple website. here is a field bundle identifier. If this bundle identifier is a complete string, the field in the file must be exactly the same as the latter. If the field in APP IDs contains a wildcard *, the strings in the file must conform to the description of the latter.

Infodictionary version --- version information in the format of cfbundleinfodictionaryversion info. plist

Bundle OS type code -- cfbundlepackagetype: the four-letter long code used to identify the bundle type ??)

Bundle versions string, short --- cfbundle‑versionstring the version string of the bundle for the user market ??)

Bundle creator OS type code --- cfbundlesignature: the four-letter code used to identify the creator ??)

Bundle version --- cfbundleversion application version number. This number is added each time you deploy a new version of the application on the app store.

Application require iPhone environment -- lsrequiresiphoneos: Used to indicate whether the package can only run on the iPhone OS. Xcode automatically adds this key and sets its value to true. You should not change the value of this key.

Main NIB file base name --NSMainNibFileThis is a string that specifies the name of the application master NIB file. If you want to use another NIB file (instead of the default file created by xcode for the Project) as the master NIB file, you can associate the NIB file name with this key. The NIB file name should not contain.nibExtension. This field can be deleted. You can refer to my previous article, Main Function Research.

Supported interface orientations -- the direction supported by the uisupportedinterfaceorientations program by default.
 

Related Article

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.