Recognizing Speech in Live Audio Sample Project

I'm developing a project where I want to transcribe live speech from the user on IOS devices.

I wanted to test out the Speech framework by downloading the sample code from https://developer.apple.com/documentation/speech/recognizing_speech_in_live_audio.

I'm using Xcode 15 and running it on an Ipad with IOS 17 installed. I run the app and manage to approve the permissions to use the microphone and to use live speech transcription, but as soon as I press 'start recording', I get the following error in Xcode, and nothing happens on the ipad screen.

+[SFUtilities issueReadSandboxExtensionForFilePath:error:] issueReadSandboxExtensionForFilePath:error:: Inaccessible file (/var/mobile/Containers/Data/Application/1F1AB092-95F2-4E5F-A369-475E15114F26/Library/Caches/Vocab) : error=Error Domain=kAFAssistantErrorDomain Code=203 "Failed to access path: /var/mobile/Containers/Data/Application/1F1AB092-95F2-4E5F-A369-475E15114F26/Library/Caches/Vocab method:issueReadSandboxExtensionForFilePath:error:" UserInfo={NSLocalizedDescription=Failed to access path: /var/mobile/Containers/Data/Application/1F1AB092-95F2-4E5F-A369-475E15114F26/Library/Caches/Vocab method:issueReadSandboxExtensionForFilePath:error:}

Can someone guide me in the right direction to fix this?

Replies

Hi @Victor_O24,

I ran into the same problem trying to use the code in an app with SwiftUI that I'm building. Might not be the exact issue you're having but hopefully it helps you.

The problem area was the lmConfiguration variable.

When I removed this line of code:

recognitionRequest.customizedLanguageModel = self.lmConfiguration

I was able to start recording. The problem was that the file for language config in the Xcode example wasn't in my new project.

If the sample code isn't working, maybe the datagenerator directory with the main file isn't included?

Cheers, Lukas