XCode's Stack Trace throws an exception during debugging and locates a certain line of code

When Xcode is debugging a program, there will always be a problem of not knowing where the error is. It is very urgent. Now there is another way to specifically locate the code of the error line. Try it? super easy to use

The operation is very simple:

1. Press the cmd + 6 shortcut key in the XCode interface, or click the tab directly to jump to the Breakpoint tab


2. Then click the + sign in the lower left corner to add an Exception breakpoint, as shown in the figure below.


3. Then there will be a "All Exception" debugging option:

4. Put the mouse on it, right-click and select "Edit Breakpoint", and you can view the specific content of the options as follows: (no need to make any changes)



5. When an exception occurs, it will automatically stop at the exception and will not be thrown to UIApplicationMain. You can locate the specific code that throws the exception

For example, if I use the above method to debug my buggy program, the code will be automatically located at the 975th line where the error occurred.

Guess you like

Origin blog.csdn.net/enuola/article/details/17761017