title: Can I programmatically remove files from the Xcode "copy Bundle resources" list? from a command line tool?
body: <h3>The background:</h3>
  <p>An iOS app I'm building for a client is getting absurdly big due to a large number of multimedia files the client needs to add. (videos, high-res images, and sounds.)</p>
  <p>The app drives it's UI from a set of page descriptor files that it reads at runtime. It uses those page descriptor files to load scenes from the app storyboard using unique IDs, and then each page's view controller figures out which multimedia content to display based on it's page descriptor.</p>
  <p>I plan on adding a <code>download_from_server</code> flag to the page descriptor file that tells the app that it needs to download a zip file containing all the multimedia content for this page's view controller and all child pages from a server. At runtime, the app will see the flag, stop, and ask the user to tap OK to begin downloading the content, or click cancel to go back to the previous page. If they click OK the app will download the zip file, unzip it into the documents directory, and save a persistent &quot;multimedia content downloaded&quot; flag for that page. The app will know to look for multimedia assets in both the documents directory and the app bundle.</p>
  <p>I will write a batch tool that walks the tree of file descriptors. When it finds a descriptor who's <code>download_from_server</code> flag is set, it will build a zipfile from the multimedia content for that page and all of it's child pages. I'll then upload all those zipfiles to the server.</p>
  <h3>My Question:</h3>
  <p>Can I make my batch tool modify Xcode's settings for the multimedia files in the project that are being uploaded to the server so those files are no longer copied into the app bundle, and if so, how? I want to be able to delete those entries from the &quot;Copy Bundle Resources&quot; build phase file list. (Or un-check the target membership checkbox, which I believe does the same thing.)</p>
  <p>I am not exepert in the intricacies of makefiles and build rules, so I need guidance.</p>
  <h2>EDIT:</h2>
  <p>It appears that Xcode uses entries in the project's <code>project.pbxproj</code> file to track which files are copied into the application at build time.</p>
  <p>When I made a copy of the <code>project.pbxproj</code> from a project, un-checked the &quot;target membership&quot; checkbox for a file, and made another copy of the <code>project.pbxproj</code> file, and compared them, I found 2 differences. When the file in question has it's &quot;target membership&quot; checkbox checked, it is listed in 3 places in <code>project.pbxproj</code>, and when the checkbox is not checked, it is only listed in 2 places.</p>
  <p>The 2 entries that are removed are:</p>
  <p>An entry in what looks like an &quot;objects&quot; dictionary at the top of the file, marked with a comment line</p>
  <pre><code>/* Begin PBXBuildFile section */
  </code></pre>
  <p>And in a section marked with a comment /* Resources *, in a list with the key &quot;files&quot;, that appears to be an array of file IDs (long hex strings.)</p>
  <p>Whether the file's target membership checkbox is checked or not, it appears in another array of file IDs marked with the comment <code>/* Begin PBXFileReference section */</code>.</p>
  <p>It looks to me like I could delete the entry line in the objects dictionary and in the array of file IDs in the Resources section.</p>
  <p>Can anyone reading this chime in on the safety and effectiveness of programmatically modifying an Xcode project's <code>project.pbxproj</code> file to remove files from the <code>Copy Bundle Resources</code> build phase?</p>