title: How to create PLIST files programmatically in iphone
body: <p>I was looking to create plist file in my application Documents folder programmatically in objective C. I created a folder in documents directory :</p>
  
  <pre><code>NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
  NSString *documentsDirectoryPath = [paths objectAtIndex:0];
  NSString *path = [NSString stringWithFormat:@"%@/Data.plist", documentsDirectoryPath];
  </code></pre>
  
  <p>I am trying to create plist file which will look like an XML file.
  /**** Required XML File ****/</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
  &lt;plist version="1.0"&gt;
  &lt;array&gt;
  &lt;dict&gt;
      &lt;key&gt;height&lt;/key&gt;
      &lt;integer&gt;4007&lt;/integer&gt;
      &lt;key&gt;name&lt;/key&gt;
      &lt;string&gt;map&lt;/string&gt;
      &lt;key&gt;width&lt;/key&gt;
      &lt;integer&gt;6008&lt;/integer&gt;
  &lt;/dict&gt;
  &lt;/array&gt;
  &lt;/plist&gt;
  </code></pre>
  
  <p>/****Achieved file through code ****/</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"  "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
  &lt;plist version="1.0"&gt;
  &lt;dict&gt;
      &lt;key&gt;height&lt;/key&gt;
      &lt;string&gt;4007&lt;/string&gt;
      &lt;key&gt;name&lt;/key&gt;
      &lt;string&gt;map&lt;/string&gt;
      &lt;key&gt;width&lt;/key&gt;
      &lt;string&gt;6008&lt;/string&gt;
  &lt;/dict&gt;
  &lt;/plist&gt;
  </code></pre>
  
  <p>The required file needs an array and inside the array we have a dictionary object. How can I change this ?
  I also know how to write the file to the path, but the major issue is how to create plist file and then read it ?</p>