Thanks for being a part of WWDC25!

How did we do? We’d love to know your thoughts on this year’s conference. Take the survey here

Requesting user Permission for Speech Framework crashes visionOS simulator

When a new application runs on VisionOS 2.4 simulator and tries to access the Speech Framework, prompting a request for authorisation to use Speech Recognition, the application freezes.

Using Swift 6. Report Identifier: FB17666252

@MainActor
    func checkAvailabilityAndPermissions() async {
        logger.debug("Checking speech recognition availability and permissions...")
        
        // 1. Verify that the speechRecognizer instance exists
        guard let recognizer = speechRecognizer else {
            logger.error("Speech recognizer is nil - speech recognition won't be available.")
            reportError(.configurationError(description: "Speech recognizer could not be created."), context: "checkAvailabilityAndPermissions")
            self.isAvailable = false
            return
        }
        
        // 2. Check recognizer availability (might change at runtime)
        if !recognizer.isAvailable {
            logger.error("Speech recognizer is not available for the current locale.")
            reportError(.configurationError(description: "Speech recognizer not available."), context: "checkAvailabilityAndPermissions")
            self.isAvailable = false
            return
        }
        logger.trace("Speech recognizer exists and is available.")

        // 3. Request Speech Recognition Authorization
        // IMPORTANT: Add `NSSpeechRecognitionUsageDescription` to Info.plist
        let speechAuthStatus = SFSpeechRecognizer.authorizationStatus() // FAILS HERE
        logger.debug("Current Speech Recognition authorization status: \(speechAuthStatus.rawValue)")
        
        if speechAuthStatus == .notDetermined {
            logger.info("Requesting speech recognition authorization...")
            // Use structured concurrency to wait for permission result
            let authStatus = await withCheckedContinuation { continuation in
                SFSpeechRecognizer.requestAuthorization { status in
                    continuation.resume(returning: status)
                }
            }
            logger.debug("Received authorization status: \(authStatus.rawValue)")
            
            // Now handle the authorization result
            let speechAuthorized = (authStatus == .authorized)
            handleAuthorizationStatus(status: authStatus, type: "Speech Recognition")
            
            // If speech is granted, now check microphone
            if speechAuthorized { 
                await checkMicrophonePermission()
            }
        } else {
            let speechAuthorized = (speechAuthStatus == .authorized)
            handleAuthorizationStatus(status: speechAuthStatus, type: "Speech Recognition")
            
            // If speech is already authorized, check microphone
            if speechAuthorized {
                await checkMicrophonePermission()
            }
        }
    }

One clarification and one apology.

isAvailable is a boolean flag, declared inside the class this function inhabits.

This post should have been labelled under developer tools & services > Simulator rather than SwiftUI.

Requesting user Permission for Speech Framework crashes visionOS simulator
 
 
Q