I've created an AVAudioSession with AVAudioSessionCategoryPlayAndRecord
and AVAudioSessionCategoryOptionDefaultToSpeaker | AVAudioSessionCategoryAllowBluetooth
as option.
As long as a device with speaker and mic is connected everything is fine.
The sound comes out of the external-speaker and the input is recorded via external-mic.
But when I connect a Bluetooth-Speaker (i.e. Bose SoundLink) then the output switches to the iPhone-Speaker.
The weird thing for me is, that the Bluetooth-Speaker is listed in [[AVSession sharedInstance] availableInputs]
Using AVAudioSessionCategoryAllowBluetoothA2DP
is not an option as this always uses the iPhone-BuiltIn-Microphone.
What I found out is the Bose SoundLink reports an Mic-Input although it does not have a Built-In Mic, but it offers the possibility to hook up an external Mic. So therefore it's a not perfect device to test with.
Anyway, my problem is still to find out if a newly connected device is a speaker-only or a has an internal mic.