本文介绍了AVAudioEngine在iOS14中获取inputNode属性崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个启动audioEngine的功能.

Here is a function start audioEngine.

- (void)startAudioEngine {
    NSError *error = nil;
    if (!self.audioEngine.isRunning) {
        self.audioEngine = [[AVAudioEngine alloc] init];
        AVAudioInputNode *inputNode = self.audioEngine.inputNode;
        AVAudioFormat *nativeAudioFormat = [inputNode inputFormatForBus:0];
        __weak typeof(self)weakSelf = self;
        [inputNode installTapOnBus:0 bufferSize:1024 format:nativeAudioFormat block:^(AVAudioPCMBuffer * _Nonnull buffer, AVAudioTime * _Nonnull when) {
            [weakSelf.recognitionRequest appendAudioPCMBuffer:buffer];
        }];
        [self.audioEngine prepare];
        [self.audioEngine startAndReturnError:&error];
        if (error) {
            [self stop];
            [self onError:[NSError errorWithDomain:@"startAudioEngine error" code:0 userInfo:nil]];
        }
        else {
            [self activeStatusChanged:MMSpeechRecognizerActiveStatusStared];
        }
    }
    else {
        [self stop];
        [NSError errorWithDomain:@"The audio engine is runing" code:0 userInfo:nil];
    }
}

在iOS 14中在self.audioEngine.inputNode行处崩溃.

Crashed in iOS 14 at self.audioEngine.inputNode line.

以下是一些错误日志:

[plugin] AddInstanceForFactory: No factory registered for id <CFUUID 0x6000032144c0> F8BB1C28-BAE8-11D6-9C31-00039315CD46
HALB_IOBufferManager_Client::GetIOBuffer: the stream index is out of range
HALB_IOBufferManager_Client::GetIOBuffer: the stream index is out of range
[aqme] 255: AQDefaultDevice (1): output stream 0: null buffer
[aqme] 1778: EXCEPTION thrown (-50): error != 0
 Initialize: Mach message timeout. Apparently deadlocked. Aborting now.
CoreSimulator 725.10 - Device: iPhone 11 (003A9CF3-FDD7-4C44-8607-CAB3FDBB904B) - Runtime: iOS 14.0 (18A5301v) - DeviceType: iPhone 11

consol中的PO bt显示如下:

PO bt in the consol show this:

(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
  frame #0: 0x00007fff215a233a libsystem_kernel.dylib`pthread_kill + 10
  frame #1: 0x00007fff215d7e60 libsystem_pthread.dylib`pthread_kill + 430
  frame #2: 0x00007fff200c7c24 libsystem_c.dylib`abort + 120
  frame #3: 0x00000001082ce5c9 AudioToolboxCore`_ReportRPCTimeout(char const*, int) + 90
  frame #4: 0x0000000130cffbd9 libEmbeddedSystemAUs.dylib`_CheckRPCError(char const*, int, int) + 92
  frame #5: 0x0000000130cfc4e0 libEmbeddedSystemAUs.dylib`AURemoteIO::Initialize() + 1878
  frame #6: 0x0000000130d15ec6 libEmbeddedSystemAUs.dylib`AUBase::DoInitialize() + 36
  frame #7: 0x0000000130c9c47f libEmbeddedSystemAUs.dylib`AUMethodInitialize(void*) + 59
  frame #8: 0x00000001083c31bb AudioToolboxCore`-[AUAudioUnitV2Bridge allocateRenderResourcesAndReturnError:] + 77
  frame #9: 0x0000000105aa0dbf AVFAudio`AUInterfaceBaseV3::Initialize() + 45
  frame #10: 0x0000000105a8b90f AVFAudio`AVAudioIONodeImpl::GetInputFormat(unsigned long) + 125
  frame #11: 0x0000000105a8b5d3 AVFAudio`AVAudioIONodeImpl::SetOutputFormat(unsigned long, AVAudioFormat*) + 571
  frame #12: 0x0000000105a86022 AVFAudio`-[AVAudioNode setOutputFormat:forBus:] + 70
  frame #13: 0x0000000105a9d1e3 AVFAudio`AVAudioEngineImpl::UpdateInputNode(bool) + 921
  frame #14: 0x0000000105a98fd8 AVFAudio`-[AVAudioEngine inputNode] + 88
 * frame #15: 0x0000000102c64391 iOS14Demo`-[MMSpeechRecognizer startAudioEngine](self=0x0000600002777c40, _cmd="startAudioEngine") at MMSpeechRecognizer.m:72:56
  frame #16: 0x0000000102c651fd iOS14Demo`-[MMSpeechRecognizer start](self=0x0000600002777c40, _cmd="start") at MMSpeechRecognizer.m:175:13
  frame #17: 0x0000000102c63929 iOS14Demo`-[ViewController siriBtnClick:](self=0x00007f8dda60b650, _cmd="siriBtnClick:", sender=0x00007f8ddb80b3a0) at ViewController.m:66:9
  frame #18: 0x0000000114403f15 UIKitCore`-[UIApplication sendAction:to:from:forEvent:] + 83
  frame #19: 0x0000000113d5da2a UIKitCore`-[UIControl sendAction:to:forEvent:] + 223
  frame #20: 0x0000000113d5dd4d UIKitCore`-[UIControl _sendActionsForEvents:withEvent:] + 332
  frame #21: 0x0000000113d5c636 UIKitCore`-[UIControl touchesEnded:withEvent:] + 500
  frame #22: 0x000000011443f389 UIKitCore`-[UIWindow _sendTouchesForEvent:] + 1287
  frame #23: 0x00000001144411ea UIKitCore`-[UIWindow sendEvent:] + 4750
  frame #24: 0x000000011441b39d UIKitCore`-[UIApplication sendEvent:] + 428
  frame #25: 0x00000001144aabb1 UIKitCore`processEventQueue + 14793
  frame #26: 0x00000001144a175f UIKitCore`eventFetcherSourceCallback + 106
  frame #27: 0x00000001034f18bc CoreFoundation`CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17
  frame #28: 0x00000001034f17fb CoreFoundation`CFRunLoopDoSource0 + 157
  frame #29: 0x00000001034f0f3f CoreFoundation`CFRunLoopDoSources0 + 222
  frame #30: 0x00000001034eba20 CoreFoundation`CFRunLoopRun + 882
  frame #31: 0x00000001034eb2fa CoreFoundation`CFRunLoopRunSpecific + 538
  frame #32: 0x00000001081ebdb3 GraphicsServices`GSEventRunModal + 139
  frame #33: 0x00000001143fd942 UIKitCore`-[UIApplication _run] + 912
  frame #34: 0x0000000114402f62 UIKitCore`UIApplicationMain + 1570
  frame #35: 0x0000000102c660ca iOS14Demo`main(argc=1, argv=0x00007ffeecf9bc80) at main.m:17:12
  frame #36: 0x00007fff20222941 libdyld.dylib`start + 1
(lldb)

iOS14.Xcode12-beta.

iOS14. Xcode12-beta.

在self.audioEngine.inputNode行崩溃.在iOS14上坠毁.在iOS14之前不会崩溃.

Crashed at the self.audioEngine.inputNode line. Crashed at iOS14. Does not crash before iOS14.

为什么?系统API是否在iOS14中出错?

Why? System API'bug in iOS14?

推荐答案

这是Apple的iOS系统错误.

This is an iOS system bug with Apple.

该问题已由Apple解决.出现在版本12.0 beta(12A6159)中.Apple在版本12.0 beta 2(12A6163b)中解决了此问题.

The problem has been resolved by Apple.Appears in Version 12.0 beta (12A6159).Resolved in Version 12.0 beta 2 (12A6163b) by Apple.

下一步:更新Xcode并再次测试.

Next: Update Xcode and test again.

谢谢.

这篇关于AVAudioEngine在iOS14中获取inputNode属性崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-20 02:57