The debugger is a very useful tool. But very often, I turn to the old trusty NSLog
(and friends) for debugging. If you are trying to narrow down an issue using logging, the add NSLog
statements, recompile, run, tap that button to replicate the issue, check output cycle can be inefficient. This is where breakpoints are incredibly useful.
- Click at the gutter in Xcode editor on the line of code where you want to perform the logging.
- Ctrl-click the breakpoint and choose
Edit Breakpoint
- Click
Add Action
- Choose
Log Message
- Type the message to log in the
Message
textbox - Check
Automatically continue after evaluating actions
Trigger the issue. No re-compilation required. Yay!
There's a couple of useful options in the dialog such as making it speak out the message instead of logging.
Your feedback is valuable: Do you want more nuggets like this? Yes or No
.
.