views:

371

answers:

1

Hi,

I want to be able to launch a Run Script Build Phase in XCode that does this:

/usr/bin/say "Broke it." if my build fails.

Not sure how to capture the build failure to prompt that though? Two reasons I guess, one "what to catch", two "the build is done so the script has already run in theory... ?"

How would you do this?

Thanks // :)

A: 

If you're specifically interested in playing audio, I'd recommend converting the audio into a sound recording and playing back that audio using the PBXBuildFailureSound default for Xcode. Something like:

defaults write com.apple.Xcode PBXBuildFailureSound /path/to/sound

See the Xcode User Default Reference for more interesting Xcode tricks.

To convert the audio of /usr/bin/say to an aiff file using a utility like SoundFlower and the audio recording feature of QuickTime Player.

Joey Hagedorn