Steps to Create and Edit a Plist File in Xcode

Steps to create and edit a plist file in Xcode

Right click on the folder you want to add it to and choose "New file…"

From the Dialog - create a new Resource file of type Property List:

Sample Image

Give it whatever name you want, the plist extension will be added for you. In this case I've created Root.plist

This will bring up a blank file with columns for Key, Type and Value.

Sample Image

Right click in the file and choose "Add Row"

Sample Image

Choose any of the presented options, you'll be overwriting it anyway.

Sample Image

Now change the Key to "Apple". Right click in the type section, where it currently says String and change it to Array.

Sample Image

Click on the disclosure triangle next to where it says Apple so it faces downwards and then right click in the row and choose "Add Row" This will create a subrow under the Apple key. Repeat this until you have three rows:

Sample Image

Edit the values to the three items that you want

Sample Image

Click on the Disclosure triangle to the left of "Apple" on the top row so it points to the right. Right click on the row and choose "Add Row". This will create a new top level item.

Sample Image

Since you have four top level items, each which contains an array, repeat the above process so that you get the structure you want.

Sample Image

If you want to see the raw plist file, right click on the plist file in the project navigator and choose "Open As | Source Code"

Sample Image

And you'll see the raw file

Sample Image

And to get back to the editor view: right click on the file again and choose "Open As | Property List"

Sample Image

Modify plist file in xcode

Your bundle is read-only on a device.

The best solution would be to load your plist, save it in a directory of your chosing using the NSFileManager, and then work with the file in that directory.

Your plist inside the bundle would ONLY be used the very first time your user uses the app, as a blueprint if you will, and then you would work with the .plist you saved in the documents directory.

This small code snippet will explain how to copy a file from your bundle safely. He uses it with a database but it's really the same for any kind of file.

How to create Entitlement.plist file in Xcode?

You can manage the Entitlements in the Capabilities tab of your target settings.

Any change there will automatically update either the Entitlements.plist or the Info.plist file.

That being said, an Entitlements.plist file is in the end just a plist. You can add as much plists as you like following the steps provided in this question.

how to create plist file in xcode 4.3.2

You can put that plist file anywhere you want.
The important thing will be copying it into the bundle. So to be sure for that check
project settings>build phases>copy bundle resources

You can open project settings by left-clicking on your project in the project navigator.

How do you edit the Info.Plist file

The Document-Based Applications Overview has a section called Storing Document Types Information in the Application's Property List. In that section, they explain how to edit Info.plist so that it lists supported document types. Their example is TextEdit, which opens RTF and plain text files much like what you want.

To open the window depicted in Figure 1, double click your target in the project folder tree (under the Targets section) and select the Properties tab.

How to add files to .plist in xcode iphone project?

Please read this question and answer. You can get some ideas.

Steps to create and edit a plist file in Xcode

Thanks.



Related Topics



Leave a reply



Submit