XCode 26: AVAudioSession.CategoryOptions.allowBluetooth deprecated

When I compile my project, I got .allowBluetooth deprecated error, when I check the document:
allowBluetooth | Apple Developer Documentation, it shows that this option is deprecated and only available on iOS 1.0 - 8.0. there are no recommended alternative option in the document, XCode 26 tells me that I should use .allowBluetoothHFP instead but there's no such option in XCode 16, although the document said that it's available since iOS 1.0+. It's really confusing.

The situation is: XCode 16 only has .allowBluetooth and XCode 26 tells you must use .allowBluetoothHFP, I must force other developers upgrade to 26 immediatelly after changed .allowBluetooth to .allowBluetoothHFP

Tip: You can use the following code to avoid affecting other RD in your team.

#if compiler>=(6.2) // For Xcode 26.0+
.allowBluetoothHFP
#else
.allowBluetooth
#else
1 Like

Good idea, I will have a try.

The .bluetoothHFP enum case is defined to the same raw value as .bluetooth for backward compatibility. But yeah, this was not a source compatible change. The old name should have been marked deprecated in iOS 26.0, not iOS 8.0.

Can you please file feedback via Feedback Assistant and share the FB number here?

2 Likes

Sure, the FB number is FB18660476