From 5a66f03400568753c8e02234a509ce742ed61a19 Mon Sep 17 00:00:00 2001 From: "evgeniy.chernomortsev" Date: Tue, 9 Dec 2025 14:50:34 +0400 Subject: [PATCH] fix(build): exclude allowBluetoothHFP on iOS Simulator allowBluetoothHFP is not available on iOS Simulator, causing build failures. Use conditional compilation to exclude this option when building for simulator while keeping it for device builds. --- bitchat/Features/voice/VoiceRecorder.swift | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/bitchat/Features/voice/VoiceRecorder.swift b/bitchat/Features/voice/VoiceRecorder.swift index 577799c9..ad02d95d 100644 --- a/bitchat/Features/voice/VoiceRecorder.swift +++ b/bitchat/Features/voice/VoiceRecorder.swift @@ -58,11 +58,20 @@ final class VoiceRecorder: NSObject, AVAudioRecorderDelegate { guard session.recordPermission == .granted else { throw RecorderError.microphoneAccessDenied } + #if targetEnvironment(simulator) + // allowBluetoothHFP is not available on iOS Simulator + try session.setCategory( + .playAndRecord, + mode: .default, + options: [.defaultToSpeaker, .allowBluetoothA2DP] + ) + #else try session.setCategory( .playAndRecord, mode: .default, options: [.defaultToSpeaker, .allowBluetoothA2DP, .allowBluetoothHFP] ) + #endif try session.setActive(true, options: .notifyOthersOnDeactivation) #endif #if os(macOS)