这是我在日志中看到的内容:
16:33:20.236: Call is Dialing
16:33:21.088: AVAudioSessionInterruptionNotification
16:33:21.450: AVAudioSessionRouteChangeNotification
16:33:21.450: ....change reason CategoryChange
16:33:21.539: AVAudioEngineConfigurationChangeNotification
16:33:21.542: Starting Audio Engine
16:33:23.863: AVAudioSessionRouteChangeNotification
16:33:23.863: ....change reason OldDeviceUnavailable
16:33:23.860 ERROR: [0x100a70000] AVAudioIONodeImpl.mm:317: ___ZN13AVAudioIOUnit11GetHWFormatEjPj_block_invoke: required condition is false: hwFormat
*** Terminating app due to uncaught exception 'com.apple.coreaudio.avfaudio', reason: 'required condition is false: hwFormat'
Run Code Online (Sandbox Code Playgroud)
我订阅了两个AVAudioEngineConfigurationChangeNotification,AVAudioSessionInterruptionNotification:
@objc private func handleAudioEngineConfigurationChangeNotification(notification: NSNotification) {
println2(notification.name)
makeEngineConnections()
startEngine()
}
@objc private func handleAudioSessionInterruptionNotification(notification: NSNotification) {
println2(notification.name)
if let interruptionType = AVAudioSessionInterruptionType(rawValue: notification.userInfo?[AVAudioSessionInterruptionTypeKey] as! UInt) { …Run Code Online (Sandbox Code Playgroud) 我正在iPhone6 PlusaudioApp上进行测试,插入或拔出耳机后会崩溃。
,,在我的应用程序使用。AVAudioEngineAVAudioMixerAVAudioPlayerNode
不带耳机的启动应用程序可以播放iPhone扬声器的声音。
带有耳机的启动应用程序可以播放耳机的声音。
在以下情况下会发生错误。启动不带耳机的应用,并播放扬声器的声音。然后,如果我连接耳机,则耳机没有声音。之后拔下耳机的插头,即使扬声器也没有声音。当我触摸屏幕时,audioApp崩溃。
与使用耳机启动应用程序相同,然后将我的耳机拔出。
如何解决此错误?非常感谢您的建议。
这是我收到的错误消息。
Terminating app due to uncaught exception 'com.apple.coreaudio.avfaudio', reason: 'required condition is false: _engine->IsRunning()'
*** First throw call stack:
(0x184d61e48 0x1954a80e4 0x184d61d08 0x1836d26c0 0x1836fa328 0x1836f975c 0x1000d03c0 0x1000d0728 0x1895450f8 0x18952e22c 0x189544a94 0x189544720 0x18953dc74 0x18951138c 0x1897b01b4 0x18950f8f4 0x184d1a0e8 0x184d1938c 0x184d1743c 0x184c451f4 0x18ddd35a4 0x189576784 0x1000d5614 0x1000d5654 0x195b16a08)
libc++abi.dylib: terminating with uncaught exception of type NSException
Run Code Online (Sandbox Code Playgroud)