Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

talguy

macrumors member
Original poster
Jun 17, 2009
30
0
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
 
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.
 
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
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.