AppleWatch Development Tutorial Debug program using Help documentation Debugging Program of AppleWatch Development tutorial
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 Breakpointat 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, as shown in2.39 .
Figure 2.39 Add Breakpoint
2. running the program
When you click the Run button, the program runs. The running program stops 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 in2.40 . Not only that, theiWatch Simulator will also be displayed, but there is no content.
Figure 2.40 Execute 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 in2.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, if there is a next breakpoint, stops at the 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 in the breakpoint navigation, click Continue Program Execution button 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 delete Breakpoint command.
q Select the line where the breakpoint is set, and in xcode debug| breakpoints| Remove breakpoint at current line command.
q When you select a breakpoint and drag it elsewhere, 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 in2.42 .
Figure 2.42 Obsolete Breakpoint
The AppleWatch Development courseworking with help documents
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 in2.43 .
Figure 2.43 Help Documentation
2. Find
If you want to find a method, you can enter this method in the search field. 2.44 is shown. After you enter, you can find the content of the response.
Figure 2.44 Search 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