From ada82bb6be3669e451e55c71225673681ef7f5d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20S=C4=99k?= Date: Tue, 10 Feb 2026 17:47:07 +0100 Subject: [PATCH] fix: use bt hfp value for backward compability --- .../ios/audioapi/ios/system/AudioSessionManager.mm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/react-native-audio-api/ios/audioapi/ios/system/AudioSessionManager.mm b/packages/react-native-audio-api/ios/audioapi/ios/system/AudioSessionManager.mm index cb9cca613..a8d5bb5b8 100644 --- a/packages/react-native-audio-api/ios/audioapi/ios/system/AudioSessionManager.mm +++ b/packages/react-native-audio-api/ios/audioapi/ios/system/AudioSessionManager.mm @@ -406,7 +406,12 @@ - (AVAudioSessionCategoryOptions)optionsFromArray:(NSArray *)optionsArray } if ([option isEqualToString:@"allowBluetoothHFP"]) { - options |= AVAudioSessionCategoryOptionAllowBluetoothHFP; + // XCode 26.x (default support SDK >= 26.x) uses AVAudioSessionCategoryOptionAllowBluetoothHFP as new standard for every platfrom (down to iOS 1.0) + // Older Xcode (default support SDKs) versions doesn't define it at all. + // Both (AVAudioSessionCategoryOptionAllowBluetooth in SDK < 26.x) and (AVAudioSessionCategoryOptionAllowBluetoothHFP in SDK >= 26.x) resolve to this value + // We use it here directly as there is no reliable way to switch between them (no @available for this). + // TODO: replace with AVAudioSessionCategoryOptionAllowBluetoothHFP once XCode 16.x will dig its grave + options |= 0x4; } if ([option isEqualToString:@"defaultToSpeaker"]) {