'SFSpeechRecognizer fails with error kAFAssistantErrorDomain Code=1107

I'm trying to transcribe local audio files in my app. Short files recognised fine, but if audio is more than about 15 min it is not. Console immediately shows this error:

2020-01-17 12:57:07.528986+0300 App[2816:791131] [Utility] +[AFAggregator logDictationFailedWithError:] Error Domain=kAFAssistantErrorDomain Code=1107 "(null)"

This is my code:

        let localRecognitionRequest = SFSpeechURLRecognitionRequest(url: fileUrl)
        localRecognitionRequest.shouldReportPartialResults = false
        if speechRecognizer.supportsOnDeviceRecognition {
            localRecognitionRequest.requiresOnDeviceRecognition = true
        }
        recognitionTask = speechRecognizer.recognitionTask(with: localRecognitionRequest, delegate: self)

And when there is an error, only one delegate method fires:

    func speechRecognitionTask(_ task: SFSpeechRecognitionTask, didFinishSuccessfully successfully: Bool) { }

with successfully = false

I have Xcode 11.3.1

Trying only on device - iPhone XS (iOS 13.3)

Have anyone faced this problem?



Solution 1:[1]

I was also seeing error code 1107 and as strange as this sounds, a Simulator reset fixed it for me.

While the simulator is selected:

  1. Go to the top Menu
  2. Select Device
  3. Click on Erase All Content and Settings...
  4. (Optional) Kill XCode and relaunch

Erase All Content And Settings...

This did the trick.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Pepe Ramirez