Xcode Debugging Tip: User Breakpoints
A few weeks ago, I wrote about that one weird debugging trick – using po $arg1
to print those nondescript objc_exception_throw errors. One tip I included was adding po $arg1
as an action to the Exceptions Breakpoint.
One of the advantages of putting my stuff out there is that when I write, I get to hear back from iOS devs from all over the web and learn from them. This time was no exception. @sidneydekoning mentioned the following in the comments of my blog post:
I haven’t heard of the User Breakpoint before, so I looked into it when I finally got some time to experiment.
Here is how it works:
Create Multi-Project Breakpoints
Figure out which Breakpoints you use in all of your Projects. I personally use the Exception Breakpoint and the Test Failure Breakpoint.
Since I learned about the po $arg1
trick, I also like to add that to my Exception Breakpoint as an action:
If you have other breakpoints you like to use in all your projects, do share those in the comments!
Move Breakpoint to User
The next step is super simple. Control + Click on the Breakpoint, and choose the Move Breakpoint To -> User option:
Do the same thing for all the other breakpoints you’d like to use in all your projects!
Find The Breakpoints in Another Project
Now, when you open any other Xcode project, you’ll see these breakpoint all set up for you!
Happy Debugging!