Merge pull request #918 from malkovitc/fix/voice-recorder-simulator-build

fix(build): exclude allowBluetoothHFP on iOS Simulator
This commit is contained in:
jack 2026-01-04 12:25:11 -10:00 committed by GitHub
commit 4c9f6e689e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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)