Developing multithreaded application is not something new and it’s become more and more popular with multicore processors. One thing it’s for sure, debugging multithread applications is tough.
iOS has some gotchas regarding multithread, things that if you don’t respect, may cause your application to crash or hang the users interface, for example:
- Animations outside the main thread, may crash the application.
- Performing network requests on the main thread, will hang the users interface.
We can solve those situations by using the so called Symbolic Breakpoints
and share those breakpoints with your team. Thereby, every developer can take advantage of that, and get notified, when they occur.
To help you out, we created a bunch of shared breakpoints and integrate them into your project is very easy:
- Go to your .xcodeproj
or .xcworkspace
file, right click on it, and choose Show Package Contents
.
- Open the folder xcshareddata
, then xcdebugger
(create them if not exists).
- Breakpoints are saved into Breakpoints_v2.xcbkptlist
.
- Now you just have to paste the following content into the <Breakpoints>
node.
(We could also add those by using LLDB
commands, but those won’t show up on the Breakpoints navigator)
Our list of useful breakpoints is available here
Now, whenever the breakpoint conditions are satisfied, you’ll be notified and will have a chance to quickly fix your code, before it crashes into the users hand!