AVAudioEngine вызывает сбой свойства inputNode в iOS14

Вот функция запуска 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.

Вот некоторые журналы ошибок:

[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

PO bt в консоли показывает это:

(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-бета.

Сбой в строке self.audioEngine.inputNode. Сбой на iOS14. Не вылетает до iOS14.

Почему? Ошибка системного API в iOS14?


person X-Morris    schedule 26.06.2020    source источник
comment
Хорошо, спасибо. developer.apple.com/forums/thread/651353. feedbackassistant.apple.com/feedback/7793977.   -  person X-Morris    schedule 29.06.2020
comment
Сбой на симуляторе или устройстве? Я видел подобные проблемы на симуляторах, но не на устройствах.   -  person Rob    schedule 13.03.2021


Ответы (1)


Это системная ошибка iOS с Apple.

Проблема была решена Apple. Появляется в бета-версии версии 12.0 (12A6159). Решено в версии 12.0 бета 2 (12A6163b) от Apple.

Далее: Обновите Xcode и повторите проверку.

Спасибо.

person X-Morris    schedule 08.07.2020
comment
Мой Xcode 12.4, но получаю ту же ошибку. - person Chandan Jee; 18.06.2021
comment
Это определенно не разрешено в Xcode 12.5.1. Работает при запуске ios14, но вылетает на iOS 13.7 - person TeeJaay; 22.07.2021
comment
Возможно, ошибка в iOS 13.7. - person X-Morris; 23.07.2021