AVAudioPlayer的使用+异常断点的默认设置,抛出libc++abi.dylib`__cxa_throw异常

问题:

        在使用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的类型选择
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容