diff --git a/CalenTask/Services/SpeechCaptureService.swift b/CalenTask/Services/SpeechCaptureService.swift index 2d06a8d..d50ce2b 100644 --- a/CalenTask/Services/SpeechCaptureService.swift +++ b/CalenTask/Services/SpeechCaptureService.swift @@ -2,6 +2,7 @@ import Foundation import Speech import AVFoundation import Observation +import os /// Voice capture (S6/D66): dettatura on-device → testo nella cattura. /// Italiano, offline quando il modello locale è disponibile. @@ -74,7 +75,11 @@ final class SpeechCaptureService { request = nil isRecording = false #if os(iOS) - try? AVAudioSession.sharedInstance().setActive(false, options: .notifyOthersOnDeactivation) + do { + try AVAudioSession.sharedInstance().setActive(false, options: .notifyOthersOnDeactivation) + } catch { + Log.app.error("Sessione audio: disattivazione fallita: \(error.localizedDescription, privacy: .public)") + } #endif } @@ -87,8 +92,12 @@ final class SpeechCaptureService { #if os(iOS) let session = AVAudioSession.sharedInstance() - try? session.setCategory(.record, mode: .measurement, options: .duckOthers) - try? session.setActive(true, options: .notifyOthersOnDeactivation) + do { + try session.setCategory(.record, mode: .measurement, options: .duckOthers) + try session.setActive(true, options: .notifyOthersOnDeactivation) + } catch { + Log.app.error("Sessione audio: attivazione fallita: \(error.localizedDescription, privacy: .public)") + } #endif let request = SFSpeechAudioBufferRecognitionRequest()