From 37bb7a6c301a914515e96676d552049e53ac8032 Mon Sep 17 00:00:00 2001 From: reuk Date: Tue, 10 Jun 2025 13:16:47 +0100 Subject: [PATCH] iOS: Fix deprecation warning --- modules/juce_audio_devices/native/juce_Audio_ios.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/modules/juce_audio_devices/native/juce_Audio_ios.cpp b/modules/juce_audio_devices/native/juce_Audio_ios.cpp index 2350f1bb63..d8c6d9e0be 100644 --- a/modules/juce_audio_devices/native/juce_Audio_ios.cpp +++ b/modules/juce_audio_devices/native/juce_Audio_ios.cpp @@ -371,10 +371,16 @@ struct iOSAudioIODevice::Pimpl final : public AsyncUpdater if (category == AVAudioSessionCategoryPlayAndRecord) { + #if JUCE_IOS_API_VERSION_CAN_BE_BUILT (26, 0) + constexpr auto bluetoothOption = AVAudioSessionCategoryOptionAllowBluetoothHFP; + #else + constexpr auto bluetoothOption = AVAudioSessionCategoryOptionAllowBluetooth; + #endif + options |= AVAudioSessionCategoryOptionDefaultToSpeaker - | AVAudioSessionCategoryOptionAllowBluetooth | AVAudioSessionCategoryOptionAllowAirPlay - | AVAudioSessionCategoryOptionAllowBluetoothA2DP; + | AVAudioSessionCategoryOptionAllowBluetoothA2DP + | bluetoothOption; } JUCE_NSERROR_CHECK ([[AVAudioSession sharedInstance] setCategory: category