From 4ee2b3850a162b39fb79db3fb2f93313569219fe Mon Sep 17 00:00:00 2001 From: EdisonJwa Date: Sat, 16 May 2026 17:56:25 +0800 Subject: [PATCH] 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. --- apps/chanora_flutter/ios/Runner/AppDelegate.swift | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/chanora_flutter/ios/Runner/AppDelegate.swift b/apps/chanora_flutter/ios/Runner/AppDelegate.swift index c0c1ee0..b02871d 100644 --- a/apps/chanora_flutter/ios/Runner/AppDelegate.swift +++ b/apps/chanora_flutter/ios/Runner/AppDelegate.swift @@ -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 {