title: Archive with Xcode's command line build tool (xcodebuild archive)
body: <p>The command line tool to build Xcode projects, xcodebuild, has a new build action available in Xcode 4: <code>archive</code>.</p>
  
  <p>From <code>man xcodebuild</code>:</p>
  
  <pre><code>       archive     Archive a scheme from the build root (SYMROOT).  This requires specifying
                     a workspace and scheme.
  </code></pre>
  
  <p>Unfortunately, when I try to use it I get an error:</p>
  
  <pre><code>$ xcodebuild archive -workspace SimpleTestApp.xcworkspace -scheme SimpleTestApp
  xcodebuild: error: Failed to build workspace SimpleTestApp with scheme SimpleTestApp.
      Reason: The selected run destination is not valid for this action.
  </code></pre>
  
  <p>My impression is this doesn't actually work yet. Has anyone got it to work? If so, how?</p>