title: How can I use PlistBuddy to access an element of PreferencesSpecified by its property?
body: <p>At the moment I'm using this code</p>
  
  <pre><code>  /usr/libexec/PlistBuddy -c "Set PreferenceSpecifiers:1:DefaultValue $productVersion" "Test/Settings.bundle/Root.plist"
  </code></pre>
  
  <p>in script part of build phase to put product version in a read only field of the application settings. That field has position 1 (starting from 0) of the preferences array.</p>
  
  <p>I'm asking if it's possibile to use something more robust that 1 to access that field since position can be accidentally changed during development by me or by other developers. </p>
  
  <p>Can I access that element specifying it's identifier regardless of its position? </p>
  
  <p>To better explain my needs, I wrote down an example. I need to put something like <code>1.2.345</code> into <code>string</code> node of 2nd <code>dict</code> of <code>array</code> ie I need to change from <code>0.0.0</code> to <code>1.2.345</code>. Is it possible to access to <code>dict</code> node without stating that it's the second in the array? I'm asking for something similar to an xpath expression to be used in PlistBuddy (if any exists).</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;dict&gt;
  &lt;key&gt;PreferenceSpecifiers&lt;/key&gt;
  &lt;array&gt;
      &lt;dict&gt;
          &lt;key&gt;Title&lt;/key&gt;
          &lt;string&gt;Application info&lt;/string&gt;
          &lt;key&gt;Type&lt;/key&gt;
          &lt;string&gt;PSGroupSpecifier&lt;/string&gt;
      &lt;/dict&gt;
      &lt;dict&gt;
          &lt;key&gt;DefaultValue&lt;/key&gt;
          &lt;string&gt;0.0.0&lt;/string&gt;
          &lt;key&gt;Key&lt;/key&gt;
          &lt;string&gt;version&lt;/string&gt;
          &lt;key&gt;Title&lt;/key&gt;
          &lt;string&gt;Version&lt;/string&gt;
          &lt;key&gt;Type&lt;/key&gt;
          &lt;string&gt;PSTitleValueSpecifier&lt;/string&gt;
      &lt;/dict&gt;
      &lt;dict&gt;
          &lt;key&gt;DefaultValue&lt;/key&gt;
          &lt;string&gt;0&lt;/string&gt;
          &lt;key&gt;Key&lt;/key&gt;
          &lt;string&gt;build&lt;/string&gt;
          &lt;key&gt;Title&lt;/key&gt;
          &lt;string&gt;Build&lt;/string&gt;
          &lt;key&gt;Type&lt;/key&gt;
          &lt;string&gt;PSTitleValueSpecifier&lt;/string&gt;
      &lt;/dict&gt;
           ...
  </code></pre>