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:

Screen Shot 2015-07-16 at 8.08.20 AM

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.

Screen Shot 2015-07-16 at 8.20.04 AM

Since I learned about the po $arg1 trick, I also like to add that to my Exception Breakpoint as an action:

po $arg1 breakpoint

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:

Move Breakpoint To

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!

User Breakpoints

Happy Debugging!

Enjoy the article? Join over 20,000+ Swift developers and enthusiasts who get my weekly updates.