title: iOS: How to upgrade my CFBundleVersion and my CFBundleShortVersionString automatically in Xcode 11? (My old script doesn't work anymore)
body: <p>I have a script that upgraded my version (0.01 by 0.01) and my build (1 by 1). It doesn't work anymore with the Xcode 11.</p>
  
  <p><a href="https://i.stack.imgur.com/NNbab.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NNbab.png" alt="enter image description here"></a> </p>
  
  <p>Here is my script:  </p>
  
  <pre><code>    #!/bin/bash
      rm -rf build
  
      Version=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "$INFOPLIST_FILE")
      Version=$(echo "scale=2; $Version + 0.01" | bc)
  
      Build=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$INFOPLIST_FILE")
      Build=$($Build + 1)
  
      /usr/libexec/PlistBuddy -c "Set :CFBundleVersion $Build" 
  
      "$INFOPLIST_FILE"
          if [ "${CONFIGURATION}" = "Release" ]; then
          /usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $Version" "$INFOPLIST_FILE"    
  fi 
  </code></pre>
  
  <p>Here is the Error message I have now when I want to build or archive in Xcode:  </p>
  
  <blockquote>
    <p>Details</p>
    
    <p>Failed to install the requested application<br>
    Domain: NSPOSIXErrorDomain
    Code: 22<br>
    Failure Reason: The application's Info.plist does not contain CFBundleShortVersionString.<br>
    Recovery Suggestion: Ensure your bundle contains a CFBundleShortVersionString.<br>
    User Info: {<br>
       bundleURL = "file:///Users/olosta/Library/Developer/Xcode/DerivedData/Formbox-cxaxehrhmxqaqabbijmxvasgmhwn/Build/Products/Debug-iphonesimulator/Formbox_Renault_BusinessDays.app/";<br>
    }</p>
  </blockquote>
  
  <p>I checked that <a href="https://stackoverflow.com/questions/56450295/cannot-run-application-on-simulator-after-installing-xcode-11-cfbundleversion">ticket</a>, but it doesn't help me for the script</p>
  
  <p>If I go in Xcode/General/Identity, I can see that the "Version" and the "Build" are filled in the Xcode,  <a href="https://i.stack.imgur.com/C66Pn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/C66Pn.png" alt="enter image description here"></a> but if I check my info.plist by manually opening it, both values are empty </p>
  
  <pre><code>   &lt;key&gt;CFBundleVersion&lt;/key&gt;               &lt;string&gt;&lt;/string&gt;    
     &lt;key&gt;CFBundleShortVersionString&lt;/key&gt;    &lt;string&gt;&lt;/string&gt;
  </code></pre>
  
  <p>If I fill them manually directly in the plist, it works but it seems that the values from Xcode are not stored in that fields anymore? What do you think?</p>