XCode Build Script Question

Discussion in 'Mac Programming' started by talguy, Mar 3, 2010.

  1. talguy macrumors member

    Jun 17, 2009
    I am building an application that pulls train schedules from the internet and saves them into a database for off line usage. Everytime I build the application I would like to launch and application that would update the database before the app is ever launched so that user will download the app with the latest schedules. I will also have an updating system built into the app i just want it to be current on first launch.

    So my question, how can I have my build script launch an app to update the database and have the built script wait until the app is finished before it copies the database to the debug/release directory
  2. chown33 macrumors 604

    Aug 9, 2009
    Sailing beyond the sunset
    Add a Run Script build phase to your target. Enter the command-lines needed to pull the train schedules.

    If it's not a command-line, but a .app, then use the 'open' command to run the app, and possibly use the 'sleep' command to make sure it has time to complete. Or use some other approach that can reliably determine when your schedule-pulling app has finished. Read the man pages on open and sleep (see under Xcode's Help menu).

    Once the Run Script build phase has been added to the target, you can drag it around to run before any of the other build phases.

    Find more by reading about Run Script build phases in the Xcode docs. Use Xcode to search its own docs.

    For completeness, which Xcode version are you using? Things may differ between the various versions.
  3. talguy thread starter macrumors member

    Jun 17, 2009
    thanks chown33, I added the script and it worked. I was able to phase the build phase by having the script what for and exit status returned by the command line program

Share This Page