# ios bluetooth problem
## HFP vs A2DP
https://www.jianshu.com/p/04a1dc879c13
https://amorten.com/blog/2017/ios-bluetooth-and-microphone-input/
官方文檔
> If an application uses the **setPreferredInput:error:** method to select a Bluetooth HFP input, the output will automatically be changed to the Bluetooth HFP output. Moreover, selecting a Bluetooth HFP output using the MPVolumeView‘s route picker will automatically change the input to the Bluetooth HFP input. Therefore both the input and output will always end up on the Bluetooth HFP device even though only the input or output was set individually.
他說如果要使用HFP的輸入那麼輸出就也要使用HFP,所以要麼輸出輸入都用HFP,要麼輸出用A2DP輸入用手機內建的麥克風
而當我想要輸出輸入都用HFP時卻發現問題,輸入用HFP輸出就沒了!
於是我列出我的device資訊
```
>> <AVAudioSessionPortDescription: 0x281ec0280, type = MicrophoneBuiltIn;
name = iPhone 麥克風; UID = Built-In Microphone; selectedDataSource = 前>
>> <AVAudioSessionPortDescription: 0x281ec02e0, type = BluetoothHFP;
name = Jabra Halo Smart v1.8.1; UID = 50:1A:A5:73:04:69-tsco; selectedDataSource = (null)>
>> <AVAudioSessionPortDescription: 0x281ec43d0, type = BluetoothA2DPOutput;
name = Jabra Halo Smart v1.8.1; UID = 50:1A:A5:73:04:69-tacl; selectedDataSource = (null)>
```
可以看到我的藍芽耳麥"Jabra Halo Smart v1.8.1" 輸入是 BluetoothHFP 而輸出是 BluetoothA2DPOutput
###### tags: `note`