AppleWatch Development Tutorial Debug program using the Help document AppleWatch development Tutorial Debug Program
debugging, also known as troubleshooting, is a process of discovering and reducing program errors. There are several steps you need to implement to debug in Xcode:
1. Add a Breakpoint
Before you can debug a program, you first need to add a breakpoint to the program, which is where the debugger should stop running the program and let developers see it. Move the cursor to where you want to add a breakpoint, press and hold the Command+\ key, or select Degbug| in the menu bar. breakpoints| Add breakpoint at the current command adds a breakpoint and then sees a blue arrow at the far left of the Add breakpoint code, which is a new breakpoint, shown in 2.39.
Figure 2.39 Adding a breakpoint
2. Running the program
When you click the Run button, the program runs. At this point the running program stays at the location where the breakpoint is located, and the code line appears with a green arrow indicating where the program is now running, as shown in 2.40. Not only that, the iwatch simulator will also be displayed, but there is no content.
Figure 2.40 Executing a breakpoint
3. Breakpoint Navigation
After the program stops, the Program Debugging Information window will appear, which shows some debugging information. At the top of the Program Debugging Information window, a breakpoint navigation appears, as shown in 2.41.
Figure 2.41 Breakpoint Navigation
Q Toggle Global Breakpoint state button: Select the thread you want to view.
Q Continue Program execution button: Resumes execution of the current code and stops at the next breakpoint if there is a next breakpoint.
Q Step over button: Executes the next code. If the current row is a method call, it does not go inside the method.
Q Step into button: Enter the method content.
Q Step out button: Skips the current method, i.e. executes to the end of the current method.
At this point, click the Continue Program execution button in the Breakpoint Navigator to continue executing the current code. If there is an error at this point, the program will not jump to the next breakpoint, or the program will continue to execute if there is no problem. Now there is only one breakpoint, click this button and the program will output the final result.
4. Delete or discard breakpoints
If the program does not have a problem, then the breakpoint set in the program should be deleted or discarded. There are three ways to remove a breakpoint long:
Q Right-click on the Set breakpoint and select the Delete Breakpoint command from the popup shortcut menu.
Q Select the line that sets the breakpoint and select Debug| in the Xcode menu bar breakpoints| Remove Breakpoint at the current command.
Q Select the breakpoint and drag it somewhere else, and the breakpoint is deleted.
To discard a breakpoint, you click the breakpoint, and the breakpoint is changed from dark blue to light blue. A light blue breakpoint indicates that the breakpoint has been discarded, as shown in 2.42.
Figure 2.42 Obsolete Breakpoint
AppleWatch Development tutorials Using Help documentation
There are a number of ways you might encounter writing code. If the developer is not familiar with the functionality of these methods and the parameters, they can use the help documentation. So how does the help text open and find the relevant content? The following will solve these problems for you.
1. Open the Help document
To use the Help text, you must open it. Select help| Documentation and API Reference command, you can open it, as shown in 2.43.
Figure 2.43 Help documentation
2. Find
If you want to find a method, you can enter this method in the search field, as shown in 2.44. After you enter, you can find the content of the response.
Figure 2.44 Searching for content
This article is selected from: Apple Watch Development Quick Start Tutorial University PA information, reproduced Please indicate the source, respect the technology respect the IT person!
AppleWatch Development Tutorial Debug program using Help documentation