How to Control Your iOS App Program Execution with the Debug Bar - dummies

How to Control Your iOS App Program Execution with the Debug Bar

By Neal Goldstein, Dave Wilson

When you build and run your iOS app program with breakpoints, the Debug bar appears in the Workspace window as the program runs in the Simulator. The program stops executing at the first breakpoint (if you have set a condition, it stops executing if that condition is met).

To control the execution, you use the Debug bar (located at the top of the Debug area). The Debug bar includes buttons to

  • Open or close the Debug area. As mentioned previously, you can hide the Debug area if you don’t need it for what you’re doing right now.

  • Turn all breakpoints on or off. This will let you keep them in place for whenever you need to debug them again.

  • Pause or resume execution of your code. Click this button to stop your program from executing or continue execution after it stopped when it entered the debugger.

  • Step over. Click this button to make the process counter(PC), which is identified by the green arrow in the gutter, move to the next line of code to be executed. If that line of code sends a message, it will send the message (and run the method) — but then, from your perspective, it just moves to the next line of code.


  • Step in. Click this button to move the process counter to the next line of code to be executed. If the line of code sends a message to a method in your source code, the debugger will step to the method and then return to the next line of code after the line that sends the message.

  • Step out. Click this button to step out of the current function or method. The Source editor then displays either the method that sent the message or the function’s caller.

  • Simulate location. You can have the debugger simulate the location of the iPad for you.

You can see that the program has stopped executing at the breakpoint. If you then want to watch what happens as the program executes step-by-step, you would select Step In and proceed line by line.

At each line, you can view the values of the variables as they change (changed values are shown in blue). When you have seen what you want to see, you can resume execution or stop the app and make your repairs.