title: Synchronize app version & build number in app settings
body: <p>I have added <code>Settings.bundle</code> to my app to add version and build numbers in app settings, and it is added properly. The issue I have is, that it is always getting default value only and after that it is not updating it based on the value from actual app version and build number (even after running the app).</p>
  
  <p>Root.plist:</p>
  
  <pre class="lang-xml prettyprint-override"><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;StringsTable&lt;/key&gt;
      &lt;string&gt;Root&lt;/string&gt;
      &lt;key&gt;PreferenceSpecifiers&lt;/key&gt;
      &lt;array&gt;
          &lt;dict&gt;
              &lt;key&gt;DefaultValue&lt;/key&gt;
              &lt;string&gt;1.0&lt;/string&gt;
              &lt;key&gt;Key&lt;/key&gt;
              &lt;string&gt;current_version_number&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;/array&gt;
  &lt;/dict&gt;
  &lt;/plist&gt;
  </code></pre>
  
  <p>I have created this custom class to update version and build number:</p>
  
  <pre><code>public static class SettingsBundleHelper
  {
      static string AppVersionKey = "current_version_number";
  
      public static void SetVersionAndBuildNumber()
      {
          string version = NSBundle.MainBundle.ObjectForInfoDictionary("CFBundleShortVersionString").ToString();
          string build = NSBundle.MainBundle.ObjectForInfoDictionary("CFBundleVersion").ToString();
          NSUserDefaults.StandardUserDefaults.SetString(AppVersionKey, $"{version}({build})");
          NSUserDefaults.StandardUserDefaults.Synchronize();
      }
  }
  </code></pre>
  
  <p>App Delegate:</p>
  
  <pre><code>public override void OnActivated(UIApplication application)
  {
      SettingsBundleHelper.SetVersionAndBuildNumber();
  }
  </code></pre>
  
  <p>I followed <a href="https://medium.com/@abhimuralidharan/adding-settings-to-your-ios-app-cecef8c5497" rel="nofollow noreferrer">this tutorial</a> to implement this feature.</p>
  
  <p>After this, version number in app settings is always <code>1.0</code></p>
  
  <p><strong>Another Question:</strong></p>
  
  <p>How to implement auto increment build number in <code>Xamarin.iOS</code> app? Because I don't want to update <code>info.plist</code> build number each time I create new <code>ipa</code>.</p>