Saturday 25 May 2019

Debugging Tricks

Let's look at several debugging tricks,  especially helpful when you just joined a team facing with the large and unfamiliar codebase

Quickly find the ViewController that has been pushed along with the line in code.

Go to the Breakpoint Navigator of the left panel in  XCode
Click the + button on left bottom, choose Symbolic Breakpoint,
Add the objective-c function signature in Symbol


Disable the breakpoint and enable it just before the interaction triggers pushing that viewController.
XCode will pause the execution at the [UINavigationController pushViewController:animated:] and you will find the exact line in project in Debug Navigator just below [UINavigationController pushViewController:animated:]



Another way to find the name of ViewController or sub UIView/UIViewController
Show the Debug area, build and run, tap the Debug View Hierarchy button on the debug menu bar
Select the view controller or any UI element you want to know and check its name at the top 





LLDM commands

po to print


expression to change values at runtime without changing code and re-run


jump to skin without comment out and re-run

Edit breakpoint to put expression in Action
It also allows to continue automatically



Watch values changes, XCode will pause every time the values has been changed

No comments:

Post a Comment