IOS Development — the practical application of symbol breakpoint: locating the current ViewController

IOS Development -- the practical application of symbol breakpoint: locating the current ViewController
T-ara Park Ji Yeon

On symbol breakpoints (Symbolic Breakpoint)

A breakpoint is a breakpoint that causes the method to break, that is, we can locate the specified method by means of a breakpoint. So what’s the use of it? Think about whether you encountered such a situation: when others took over the project, cumbersome and complex, want to find the corresponding page of the ViewController, the results for a long time could not find, his exasperation, called a word: (omitted here a word).
actually, when you know the breakpoint, it’s not the case.

thinking

Each ViewController has a viewWillAppear: method, so we just need to locate the viewWillAppear: method, and then the implementation of the method of the object print out, not on the OK?

Symbol breakpoint

Let’s look at the breakpoint

IOS Development -- the practical application of symbol breakpoint: locating the current ViewController
here to add symbol breakpoint

edit symbol breakpoint

IOS Development -- the practical application of symbol breakpoint: locating the current ViewController
edit symbol breakpoint

pictured above: I add a breakpoint symbol for the interception of BaseViewController (all ViewController I have inherited from BaseViewController viewWillAppear:) method (Note: viewWillAppear: colon, because with parameters, this method can not write a interception).
I added three action to this breakpoint:

  • Po self is used to print out the object of this method on the console (do you think it’s just print out?
  • Log Message DNF is used to print out “DNF” on the console (think about why you want to print “DNF”), and why you want to print “DNF” instead of “LOL”
  • Sound Glass will be able to perform this method in a pleasant voice (just to listen to it?)

After you add the edit breakpoint to run the program, you will hear a crisp sound… This prompts you to sign the breakpoint has been executed, you might say, oh the mother said ViewController? Don’t worry, in the console search “DNF”, “DNF” above the object is your object (very satisfied?) If there is no Log dnf Message, you will find it difficult to find the object, you only slowly in the console to find your object, so now know what DNF used (to help you quickly find the object).
, for example, my results as follows:

IOS Development -- the practical application of symbol breakpoint: locating the current ViewController
find the object happy

Postscript

On the symbol breakpoint, basically so much. If there is a mistake in the paper, please be sure to put more welcome to put forward a better method or symbol breakpoint more usage, learn from each other (don’t ask me why I don’t print out “LOL”)