Breaking News

iOS Application Debugging

What is iOS – Application Debugging?

We may do mistakes while developing an application, which can result in various types of errors. In order to fix these errors or bugs, we require to debug the application.

Selecting a Debugger

Xcode has two debuggers namely, GDB and LLDB debuggers. GDB is selected. By default LLDB is a debugger that is a part of the LLVM open-source compiler project. You can alter the debugger by “edit active schemes” option.

How to Find Coding Errors?

For locating coding-related errors, you require to build your application which will compile the code. In case if the code consists of errors, the compiler will display all the messages, errors, and warnings with their feasible reasons.

You can click Product and then Analyze to locate feasible issues in an application.

Set Breakpoints

Breakpoints assists us to know the various states of our application objects, which assists us in identifying many defects along with logical issues. We just require to click over the line number for creating a breakpoint. For removing a breakpoint, just click and drag it out. The below screen shot illustrates how to set a break point:

iOS Application Debugging

When we run the application and choose the playVideo button, the application will pause at the line number where we will have to set the break point. It permits us the time to analyze the state of the application. When the break point is triggered, we will get an output as shown in below screenshot.

iOS - Application Debugging

You can easily recognise which thread has triggered the breakpoint. In the bottom, you can view the objects like self, sender and so on, which hold the values of the respective objects and we can expand some of these objects, and view the state of every one of these objects.

In order to continue the application we will choose the continue button , in the debug section as shown in below screen. The remaining options include step in, step out and step over.

iOS - Application Debugging

Exception breakpoint

We also have exception breakpoints that trigger an application that will stop the location where the exception occurs. We can also put exception breakpoints by choosing the + button after choosing the debug navigator. You will get the below window.

iOS - Application Debugging

Then we need to choose Add Exception Breakpoint, which will display the below window.

iOS - Application Debugging

You can gather some more information on debugging and other Xcode features from Xcode 4 user guide