title: Building for iOS with Corona SDK: multiple binaries are created, causing "Invalid Bundle Structure" error from Apple
body: <p>I am building an app called 'ToyBox.</p>
  
  <p>When I build for iOS, I get a ToyBox.app directory which contains a ToyBox executable and the other typical iOS-related files (Info.plist, pkg.info, etc.), in addition to my app icons, assets and source code directories.</p>
  
  <p>However the directory also contains another ToyBox.app sub-directory, which itself contains a ToyBox executable and iOS-related files and my assets directory.</p>
  
  <p>It looks like Corona is recursively compiling my app. This happens whether I build for device or the Xcode iOS simulator. There is no problem running the resulting executable on my device (iPad4) or simulating it in Xcode but when I tried to submit my app to the App Store it was rejected with the following error:</p>
  
  <blockquote>
    <p>"Invalid Bundle Structure - The binary file
    'ToyBox.app/ToyBox.app/ToyBox' is not permitted. Your app may contain
    only one executable file."</p>
  </blockquote>
  
  <p>The error is valid - there are two executables!</p>
  
  <p>(At the risk of confusing the issue, I have another, seemingly related, issue: if I build my app (either for device or Xcode simulator) then later build the app with a different name, in the same directory, the second build will include the first build and the build process will take a very long time to complete. If I was to build the app again with a third name, both previous app builds wold be included and the build would take a very (very) long time).</p>
  
  <p>I can probably work around the issue by deleting the extra files, but this seems like a hack and I'd like to know what's going on.</p>
  
  <p>I am using Corona Version 2013.1087 (2013.4.17).</p>