问题:
在使用AVAudioPlayer调用play(或prepareToPlay)进行音频的播放(或预播放)时,竟然遭遇Crash。当时就一脸懵逼,这简单的调用都会出错!经过分析与资料查询,原来是我加了那种习惯性的异常断点(Exception Breakpoint)造成的。
对于这个问题,我在这里引用一下StackOverflow上的解答:
解答1:
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.
解答2:
The problem was I normally develop with a breakpoint set to "All Exceptions", and the actual exception thrown was __cxa_throw.
Which apparently turns out to be in C++ libraries that are used to implement AVAudioPlayer.
By changing the breakpoint to "All Objective-C Exceptions" the program ran fine. (This can be done by editing the breakpoint and changing the Exception field to Objective-C.
总结:
总之,就是当两者相遇时,Exception Breakpoint你还是做出点改变吧,将你的类型由默认的“All”改为“Objective-C”。这不,他俩这会儿算是平静了,我也暂时轻松喽。
Exception Breakpoint的默认添加配置 Exception Breakpoint的类型选择
网友评论