I am using SFSpeechRecognizer and noticed this error showing up on iOS >= 13. 
This is my code for starting recognition process:
- (void)startRecording:(BOOL)collectPartialResults {    
    NSError *error;
    AVAudioSession *audioSession = [AVAudioSession sharedInstance];
    [audioSession setCategory:AVAudioSessionCategoryPlayAndRecord error:&error];
    [audioSession setMode:AVAudioSessionModeMeasurement error:&error];
    [audioSession setActive:YES error:&error];
    AVAudioInputNode *inputNode = _audioEngine.inputNode;
    _recognitionRequest = [SFSpeechAudioBufferRecognitionRequest new];
    _recognitionRequest.shouldReportPartialResults = collectPartialResults;
    _recognitionTask = [_internalRecognizer recognitionTaskWithRequest:_recognitionRequest resultHandler:^(SFSpeechRecognitionResult * _Nullable result, NSError * _Nullable error) {
       // ...
    }];
    AVAudioFormat *format = [inputNode outputFormatForBus:0];
    @try {
        [inputNode installTapOnBus:0 bufferSize:1024 format:format block:^(AVAudioPCMBuffer * _Nonnull buffer, AVAudioTime * _Nonnull when) {
            [_recognitionRequest appendAudioPCMBuffer:buffer];
        }];
    }
    @catch (NSException *exception) {
        NSLog(@"%@", exception.userInfo);
        [self sendStartRecordingErrorMessage:[NSString stringWithFormat:@"%@", exception.userInfo]];
        return;
    }
    NSError *startError;
    [_audioEngine startAndReturnError:&startError];
    if (startError != nil) {
        [self sendStartRecordingErrorMessage:[NSString stringWithFormat:@"%@", startError.userInfo]];
    }
}
This works for one or two times, but eventually leads to this error:
AVAEInternal.h:109   [AVAudioEngineGraph.mm:1397:Initialize: (err = AUGraphParser::InitializeActiveNodesInInputChain(ThisGraph, *GetInputNode())): error -10851
caused by this line: [_audioEngine startAndReturnError:&startError];
I have no idea what does this error mean. My code is almost the same as official example.
I've tried several things such as:
outputFormatForBus instead of inputFormatForBus for
installTapOnBus, audioSession mode (AVAudioSessionModeVoicePrompt),[audioEngine reset]    before starting recoding processI had the same issue. For me the solution was to use a new AVAudioEngine for each recording.
In your example:
- (void)startRecording:(BOOL)collectPartialResults {
  _audioEngine = [[AVAudioEngine alloc] init];
  // ...
}
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With