Go to: precompilation run script in xcode 4

Source: Internet
Author: User

From: http://b2cloud.com.au/how-to-guides/precompilation-run-script-in-xcode-4

Shell scripts are very handy for custom actions after compiling an xcode project, but unfortunately they can no longer be run before compiling, not as easily as before at least.

To set this up now, you must do the following:

Create a dummy target. Click "File> New Target ...". Select the "Mac OS X> Other> external build system" template. Give it a name and save.

We will use this new target to run a script. I have created a test script you can use to make sure this works. save the following to your root "mach1_hd" directory with the name "script. SH ", unless you want to figure out the path/filename for the next
Part.

#! /bin/bashecho "Yes, it worked!" >> /DidItWork?.txt

Make sure you have correct permissions to run the script, open the terminal and type

chmod +x /script.sh

Now under your project's targets, select the dummy target and in the "build tool" textbox in the "info" label enter "/script. Sh"

Now for the real magic, under your original target's "build phases", add your dummy target as a "target dependency ".

That's it! Whenever your project it built it will first build your dummy, which will run the custom script. if you used the script from above you shoshould have a text file in your root "mach1_hd" directory with some text in it

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.