title: How can I sign my Qt App command line to deploy it on iOS AppStore
body: <p>I trying to sign my <code>QtApp</code> with <code>Xcode 8.3.3</code> &amp; <code>Qt 5.7</code> for <code>iOS</code> from command line by running <code>Qmake</code> as I need to do it for my jenkins build environment.</p>
  
  <p>As I found from my question <a href="https://stackoverflow.com/questions/45039025/how-to-choose-an-ios-provisioning-profile-command-line-while-using-qmake-to-buil?noredirect=1#comment77059933_45039025">here</a>, I am manually mentioning the following in project or <code>MyApp.pro</code> file.</p>
  
  <pre><code>QMAKE_XCODE_CODE_SIGN_IDENTITY
  QMAKE_PROVISIONING_PROFILE
  QMAKE_DEVELOPMENT_TEAM 
  </code></pre>
  
  <p>But then it complains the following asking me to manually switch it from project editor ?</p>
  
  <blockquote>
    <p>MyApp has conflicting provisioning settings. MyApp is automatically
    signed, but provisioning profile xxxx-xxxx-xxxx-xxxx has been manually
    specified. Set the provisioning profile value to "Automatic" in the
    build settings editor, or switch to manual signing in the project
    editor. Code signing is required for product type 'Application' in SDK
    'iOS 10.3'</p>
  </blockquote>
  
  <p>I am well able to sign &amp; run it from Xcode UI editor but I need to do it from command line. <strong>How can I sign my app for iOS command line ?</strong></p>
  
  <p>So I tried to run <code>xcodebuild</code> on the <code>MyApp.xcodeproj</code> that was generated from <code>qmake</code> with the below command:</p>
  
  <pre><code>xcodebuild -project "MyApp.xcodeproj" -target "MyApp" -sdk "iphoneos" -configuration Release PROVISIONING_PROFILE="xxxx-xxxx-xxxx-xxxx" CODE_SIGN_IDENTITY="iPhone Distribution: Company Name (XXXXXXXXX)"
  </code></pre>
  
  <p>But I got the same error again:</p>
  
  <blockquote>
    <p>MyApp has conflicting provisioning settings. MyApp is automatically
    signed, but provisioning profile xxxx-xxxx-xxxx-xxxx has been manually
    specified. Set the provisioning profile value to "Automatic" in the
    build settings editor, or switch to manual signing in the project
    editor. Code signing is required for product type 'Application' in SDK
    'iOS 10.3'</p>
  </blockquote>
  
  <p>Else: <strong>If I want to sign a <code>.xcodeproj</code> from command line, then how should I configure code signing certificates and provisioning profiles to build to an iOS device ?</strong></p>
  
  <p><strong>Figured during investigation that:</strong><br>
  I can run the command as  </p>
  
  <pre><code>xcodebuild -project "MyApp.xcodeproj" -scheme "MyApp" -sdk "iphoneos" -configuration Release
  </code></pre>
  
  <p>to sign <strong>but</strong> before that I need to open <code>MyApp.xcodeproj</code> in <code>Xcode</code> &amp; select <code>Automatically Manage Signing</code> on <code>Xcode</code> UI to do that ? <em>Isn't there some way set Xcode to always remember the <code>Automatically Manage Signing</code> with the required provisioning profile ?</em> <strong>If this is answered by some of you experts out there then the whole problem is solved</strong></p>