fix(ios): rename allowBluetooth -> allowBluetoothHFP (iOS 26 SDK)

Xcode warning on iOS SDK 26+:
  'allowBluetooth' was deprecated in iOS 8.0: renamed to
  'AVAudioSession.CategoryOptions.allowBluetoothHFP'

The flag was renamed in iOS 8 (a decade ago) but the old name has
been kept as a soft-deprecated alias. iOS 26 SDK finally emits the
warning, and -Werror builds would fail on it. Same semantics:
permit HFP-profile Bluetooth headsets as input + output. Kept
.allowBluetoothA2DP alongside for higher-quality output-only A2DP
devices.

flutter build ios --release --no-codesign: 10.7 s, Runner.app
30.0 MB.
This commit is contained in:
EdisonJwa
2026-05-16 17:56:25 +08:00
parent 0466000733
commit 4ee2b3850a
@@ -32,7 +32,13 @@ import AVFoundation
try session.setCategory( try session.setCategory(
.playAndRecord, .playAndRecord,
mode: .voiceChat, mode: .voiceChat,
options: [.defaultToSpeaker, .allowBluetooth, .allowBluetoothA2DP] // .allowBluetoothHFP is the iOS-26-renamed form of the
// historical .allowBluetooth flag same semantics (permit
// HFP-profile Bluetooth headsets as input + output, so
// AirPods et al. route both directions). .allowBluetoothA2DP
// covers higher-quality output-only A2DP devices that lack
// a mic. Keeping both gives us the broadest BT support.
options: [.defaultToSpeaker, .allowBluetoothHFP, .allowBluetoothA2DP]
) )
NSLog("chanora_flutter: AVAudioSession category set (playAndRecord/voiceChat)") NSLog("chanora_flutter: AVAudioSession category set (playAndRecord/voiceChat)")
} catch { } catch {