Easier debugging using breakpoints with actions02 Feb 2014
If you debug solely through
NSLog you are missing the better insight the debugger can provide you. Also, it is easy to forget all those logging functions, ship them into production and, depending on the industry, even introduce security risks.
On the other hand, if you are using only basic breakpoints you might find yourself typing
po <object> just too often.
This is where breakpoint actions come handy: you can configure breakpoints that execute debugger commands like printing variables. To do so:
Right click on any pointer and select Edit Breakpoint....
Then, select Debugger Command from the Action menu and type a command to some variable in the scope of the selected breakpoint. For example:
po senderto print the debug description of an object identified as 'sender' or
p selectedSegmentto print the value of an atomic variable named 'selectedSegment'. If you feel in a verbose mood and need to output lots of stuff, you can click the '+' button and add more commands with more prints.
By selecting the option Automatically continue after evaluating, the breakpoint doesn't stop the execution of the program and behaves like an elegant version of NSLog that keeps your code clean.