O'Reilly logo

The Complete Idiot's Guide® To iPad and iPhone App Development by Troy Brant

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

NSLog

And now it’s time to discuss every programmer’s favorite pastime: debugging by printing to the console. Whether it’s using printf, System.out.println, cout, Console.writeln, echo, print, or NSLog, printing out values to debug a program is as old and sacred as programming itself. My official stance is that you should use GDB everywhere you can, but let’s face it: sometimes you just feel like throwing in an NSLog to see what’s going on. Also, as mentioned previously, there are some cases where using NSLog in your app is a debugging necessity.
So instead of pushing you firmly away from using NSLog to debug, I’ll give you some tips on how to use it effectively.

NSLog Syntax and Formatting

To truly master NSLog, you must understand the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required