Have you ever wanted to quickly see the result of a particular code path, but realized you had to stop the app, comment out or modify some code, and run the app again so that the new code follows a different path? There may be a quicker way to achieve this. Consider the following example:

The result is YES under normal circumstances, but we want to test what happens if the result was ever NO.

One way to do that is by dragging the little green arrow next to the breakpoint marker down into the else statement so that it looks like this:

The result is YES, but we have managed to get ourselves into the else condition to test what happens going down that code path.

Upon dragging the green arrow, Xcode will display the following error:

Take a second to read the error and understand it. Then, press ‘Move’ to move the instruction pointer. Now, simply resume execution of the program. Voila, you have just tested your alternative code path without stopping, commenting out or modifying the code, and restarting the app.

Categories: LLDBObjective-C

Raz

I'm 25 years old and I do stuff with computers.