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:
@@ -32,7 +32,13 @@ import AVFoundation
|
||||
try session.setCategory(
|
||||
.playAndRecord,
|
||||
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)")
|
||||
} catch {
|
||||
|
||||
Reference in New Issue
Block a user