例外情况来自于
com.apple.coreaudio.AQClIEnt (18): breakpoint 2.2
从
libc++abi.dylib`__cxa_throw:
我正在使用用户断点捕获它.
$arg1不包含任何内容
这就是我初始化AVAudioPlayer的方式
guard let path = Bundle.main.path(forResource: file,ofType: type) else { return nil }guard let url = URL(string: path) else { return nil }try? AVAudioSession.sharedInstance().setcategory(AVAudioSessioncategoryAmbIEnt,with: .mixWithOthers)try? AVAudioSession.sharedInstance().setActive(true)return try? AVAudioPlayer(contentsOf: url)
我正在播放来自异步全局调度队列的声音,播放声音的方法包含
self.sound?.preparetoPlay()self.sound?.play()
最初该文件是一个wav文件,所以我将其转换为mp3文件,但没有帮助.我也使用了完全不同的声音,它会产生相同的异常.
虽然Rollbar使用这样的stracktrace报告SIGSEGV错误,但异常本身不会使模拟器崩溃:
libpassFAudio.dylib在0x27c1c000中
使用的音频类:
import AVFoundationimport Foundationclass Audiotools { var sound: AVAudioPlayer? let dispatchQueue = dispatchQueue(label: "audio") static var shared: Audiotools = { let manager = Audiotools() return manager }() init() { self.sound = configurePlayer(withfile: files.sound.name,type: files.sound.extension) } func configurePlayer(withfile file: String,type: String) -> AVAudioPlayer? { guard let path = Bundle.main.path(forResource: file,ofType: type) else { return nil } guard let url = URL(string: path) else { return nil } try? AVAudioSession.sharedInstance().setcategory(AVAudioSessioncategoryAmbIEnt,with: .mixWithOthers) try? AVAudioSession.sharedInstance().setActive(true) return try? AVAudioPlayer(contentsOf: url) } func playSound() { self.dispatchQueue.async { self.sound?.preparetoPlay() self.sound?.play() } }}
其他Rollbar报告:
SIGSEGV: Application terminatedlibsystem_platform.dylib in _platform_memmoveAudioToolBox in Cached_DataSource::ReadFromheaderCache(long long,unsigned int,voID*,unsigned int*)AudioToolBox in Cached_DataSource::ReadBytes(unsigned short,long long,unsigned int*)AudioToolBox in AudiofileObject::ReadBytes(unsigned char,unsigned int*,voID*)AudioToolBox in AudiofileObject::ReadPacketDataVBR(unsigned char,AudioStreamPacketDescription*,voID*)AudioToolBox in AudiofileReadPacketDataAVFAudio in AVAudioPlayerCpp::AQOutputCallbackCore(OpaqueAudioQueue*,AudioQueueBuffer*)AVFAudio in AVAudioPlayerCpp::preparetoPlayQueue()AVFAudio in AVAudioPlayerCpp::playQueue(AudioTimeStamp const*)AVFAudio in AVAudioPlayerCpp::play()AVFAudio in -[AVAudioPlayer play]
还有其他人有过这种问题吗?
解决方法 事实证明,wav和mp3音频文件都已损坏.转换为aiff解决了这个问题. 总结以上是内存溢出为你收集整理的ios – 播放mp3 / wav声音会导致异常全部内容,希望文章能够帮你解决ios – 播放mp3 / wav声音会导致异常所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)