AVAudioPlayer throws breakpoint in debug mode
AVAudioPlayer and AVAudioRecorder both will throw exceptions, several of them. These are handled internally by the players but if you have a breakpoint for "All Breakpoints" (i.e. Exception: All, Break: On Throw) you will catch these exceptions. If you continue execution on these, the app will continue to run normally and not crash at all.
The only solution I've come up with so far is to click on the breakpoint bar in the Breakpoint Navigator, disabling this particular breakpoint, and running with it disabled.
When/if the app ever crashes with a thrown exception, I cmd-6, enable that breakpoint, and rerun and do whatever I did when it crashed.
Edit: setting to "Objective-C exceptions" is obviously how to do it. See above answer!
Add your exception breakpoint and edit the exception type from "All" to "Objective-C exceptions"
Some classes in AudioToolbox throw regular C++ exceptions. You can filter them off this way.
The backtrace helped a lot, thanks!. We'd started running into the same issue recently. It turns out the mp3 files it was throwing on did not have a valid ID3 tag and running them through an app such as Tagr fixed them right up!
Here's a screenshot showing how I fixed this error. I'm not sure if this is the same way that the answers above are talking about, but I assume its similar.
- Go to the Breakpoint navigator in Xcode.
- Control-click on the 'All Exceptions' line.
- Select the 'Edit Breakpoint...' option.
- Change the
Exception
fromAll
toObjective-C
.