More nasty code inspired by IRC conversations, but this time aimed at the iPhone SDK – although it will work on Mac OS X as well, and on WebObjects 4 for Windows NT, and probably on at least some flavours of NextStep. Simply drop this file into your project, and all NSLog()
output will be redirected to stdout
, using a private but documented Foundation function.
Why would you want to do that? Ahh, well, that part is covered by the iPhone SDK NDA. Lawyers, eh? It must be a pretty good reason, though, given testimonials like this.
Awesomely useful! Thanks for posting this.
This also works in The Cocotron as of r646.
Hello, I have to trouble you for this problem.
I’m new to Xcode4 and Cocoa, but when I use NSLog to try to print some string, I cannot get any output… I’ve looked in the Console and debug area.
Then I found your article via google, I added your file into my project and it way built rightly and run properly— except that I still get nothing from the debug area which I wrote in the NSLog…
Would you help me to find out how to get NSLog output in Xcode 4 ?
Nothing springs to mind. Have you tried Stack Overflow?
Thank you sooooo much!! I had this issue in Xcode 7.2 with El Capitan. I spent one and half days trying to figure out what had suddenly gone wrong after the upgrade to El Capitan. I even re-installed Xcode but the issue was still there. I just dropped your file in and it started working!!