Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Write to XCode build transcript

Is there any way to write to the XCode build transcript? What i want to do, is throw a warning if a device is not attached to the computer instead of an assertion failure in my unit test cases (some cases rely on an attached ipod).

I thought of something like the standard compiler warnings (only with custom message).

Thanks.

like image 233
Era Avatar asked May 17 '10 17:05

Era


1 Answers

In shell build phases you can write to stderr using the following format:

<filename>:<linenumber>: error | warn | note : <message>\n

It's the same format gcc uses to show errors. The filename:linenumber part can be omitted. Depending on the mode (error, warn, note), Xcode will show your message with a red or yellow badge.

If you include an absolute file path and a line number (if the error occurred in a file), double clicking the error in the build log lets Xcode open the file and jumps to the line, even if it is not part of the project. Very handy.

like image 134
Nikolai Ruhe Avatar answered Sep 21 '22 10:09

Nikolai Ruhe