Xcode Run Script Build Phase debugging
So I wanted to add a new build phase to my Xcode Project to run some shell script. It didn’t want to work and I’ve tried to find out why it didn’t work so I’ve tried some Logging. That turned out to be a bit tricky first as i’ve set Xcode to hide all messages and only show warnings and errors. To work around this you simply need to create warnings or errors. That’s pretty easy actually as you only need to write “warning: ohoh” or “error: meh” and Xcode will automatically annotate the message as warning or error:
echo "warning: ohoh" echo "error: meh"
@_karsten_
March 25th, 2010 at 22:58
If you really want to get fancy, you can include a file path and line number (and the appropriate colons), and Xcode will open that when you double-click on the entry in the build log. The exact format is:
file_path:line_num: [error|warning]: message goes here
for example, from Python I use:
print “%s:%d: %s: %s” % (filePath, lineNum, level, message)
Not all custom build script warnings/errors will have an associated file and line, but if they do, this trick can be pretty handy.
March 26th, 2010 at 13:40
You can also use echo “note: xxx”
March 26th, 2010 at 17:15
[…] thought about blogging about this several months ago, but never got around to it. And don’t skip reading the comments. […]