Pause your app in the middle of execution using breakpoints. Use the breakpoint navigator to view and manage all the breakpoints in your project.
About the Course:
Learn the fundamentals of debugging in Xcode: including breakpoints, stack traces, and visibly inspecting the view hierarchy. After this course, you'll be better able to understand what's happening throughout the flow of your app, and why!
Download the course materials here:
https://files.betamax.raywenderlich.c...
View the course over here:
https://www.raywenderlich.com/4681-be...
---
raywenderlich.com is a website focused on developing high quality programming tutorials. Our goal is to take the coolest and most challenging topics and make them easy for everyone to learn – so we can all make amazing apps.
We are also focused on developing a strong community. Our goal is to help each other reach our dreams through friendship and cooperation. As you can see below, a bunch of us have joined forces to make this happen: authors, editors, subject matter experts, app reviewers, and most importantly our amazing readers!
---
Debugging Tools
The Xcode debugging tools are integrated throughout the Xcode main window but are primarily located in the Debug area, the debug navigator, the breakpoint navigator, and the source editor. The debugging UI is dynamic; it reconfigures as you build and run your app. To customize how Xcode displays portions of the UI, choose Xcode Preferences \ Behaviors.
The illustration below shows the default layout of the Xcode debugger with the app paused at a breakpoint.
General Notes
Here are a few notes about debugging in general and some basic information about Xcode as you begin to read this chapter.
The Five Parts of Debugging and the Debugging Tools
There are five parts to the debugging workflow:
Discover. Identify a problem.
Locate. Determine where in the code the problem occurs.
Inspect. Examine the control flow and data structures of the running code to find the cause of the problem.
Fix. Apply your insight into the cause of the problem to devise a solution, and edit the code to suit.
Confirm. After editing, run the app and check it with the debugger to be sure the fix was successful.
The division of labor in these five parts of debugging are not necessarily reflected in the specifics of the debugging tools, although some tools are more pointed at discovery (for instance, the debug gauges), some are particularly useful for dealing with locations of interest in your code (breakpoints), and others are more specific to inspection (the debug area’s variables view and the debug navigator’s process view).
Think of the debugging tools as addressing the five parts of debugging more as a function of how you use them. For instance, you use the Quick Look feature to inspect the state of a graphical object as you work through a problem, but you can also think of it as being a discovery tool, using it to see how a complex graphic is “assembled” as you iterate through a set of drawing calls. In other words, how you put a tool to work for you often determines which part of the debugging effort it addresses, and it is the combination of what the tool does, what data using it uncovers, and your creative insight into the context of the situation that delivers success to your debugging efforts.
LLDB and the Xcode Debugger
The Xcode debugger uses services and functions provided by LLDB, the underlying command-line debugger that is part of the LLVM compiler development suite. LLDB is tightly integrated with the compiler, which enables it to provide the Xcode debugger with deep capabilities in a user-friendly environment. The Xcode debugger provides all the functionality needed for most debugging situations, but a little familiarity with LLDB can be helpful. For a basic introduction to LLDB, see LLDB Quick Start Guide.
Xcode Toolbar Controls
The Xcode toolbar contains the most basic controls you need to start debugging.
Run button. Click to build and run. Click and hold to select other actions (Run, Test, Profile, Analyze) from a menu. Using the Shift key modifies the menu to a “Build for” operation; similarly, using the Control key modifies the menu to perform an action “without Building.” The default operation is to build and run, which starts the debugger as well.
Stop button. Click to stop the current running task or app.
Scheme menu. Xcode schemes control the build process based on the settings they contain for the Product action you choose and the target build settings. For most uses, the defaults created with a project suffice, but there are useful debugging options configurable in the scheme editor’s Run action. A look at these options is provided in Debugging Options in the Scheme Editor.
Watch video Debugging in iOS - Learning How to Use Breakpoints - raywenderlich.com online without registration, duration hours minute second in high quality. This video was added by user Kodeco 13 November 2018, don't forget to share it with your friends and acquaintances, it has been viewed on our site 5,502 once and liked it 60 people.