Ios Application Debugging
# iOS Application Debugging
* * *
## Introduction
When developing applications, various errors may occur, leading to different kinds of bugs. To fix these errors or defects, we need to debug our apps.
### Choosing a Debugger
Xcode offers two debuggers: GDB and LLDB, with GDB being the default. LLDB is an open-source debugger developed as part of the LLVM compiler project. You can change the debugger by editing the scheme options.
### How to Find Coding Errors?
Simply build your app; the compiler will compile the code and display all messages, errors, and warnings along with their causes, allowing you to correct them. Click on Product, then select "Analyze" to identify potential issues in your application.
### Setting Breakpoints
Breakpoints help us inspect application objects and uncover many defects, including logic-related problems at different stages. To set a breakpoint, click on the line number where you want it placed. You can remove a breakpoint by clicking and dragging it away, as shown below:

When running the app and selecting the playVideo button, the app execution will pause, allowing you to analyze its state. Upon triggering the breakpoint, you'll see output similar to the following image:

You can easily determine which thread triggered the breakpoint. At the bottom, youβll find objects like `self`, `sender`, etc., holding corresponding values. Expand these objects to examine their current states.
To continue the app, click the Continue button (the leftmost button) in the debugging area, as shown below. Other options include Step Over and Step Into:
!(http://www.tutorialspoint.com/ios/images/breakpointBar.jpg)
### Exception Breakpoints
We also have exception breakpoints that stop the app when an exception occurs. Select the Debug navigator, then click the "+" button to create an exception breakpoint. A window like this will appear:

Next, choose "Exception Breakpoint (Add Exception)" to bring up the following window:

### Whatβs Next?
You can learn more about debugging and other Xcode features in the (http://developer.apple.com/library/ios/#documentation/ToolsLanguages/Conceptual/Xcode4UserGuide/Introduction/Introduction.html "Xcode 4 user guide").
AI is thinking...
[](#)(
YouTip