To expand on my previous answer and comment :
You must use the AVAudioSession method
- (BOOL)setCategory:(NSString *)category withOptions:(AVAudioSessionCategoryOptions)options error:(NSError **)outError
with category like
AVAudioSessionCategoryPlayAndRecord
or AVAudioSessionCategoryRecord
and options like
AVAudioSessionCategoryOptionAllowBluetooth
In your answer you say
This is not the same, because it will only allow A2DP Bluetooth connection
But according to Apple docs
AVAudioSessionCategoryOptionAllowBluetooth
Allows Bluetooth hands-free devices to appear as available input routes.
I understand that to refer to Bluetooth HFP, which I believe is what you need. As far as "forcing" is concerned, Apple is not too keen on applications that force / override OS control for user device behavior.
Perhaps this does not work in practice - I could not test it. Presumably you have it, and it fails (you do not indicate in your question). But you fall within the scope of Apple's documentation on this. If you really can't get it to work, I would tend to go with the deprecated C interface and be prepared to make changes for iOS8.
foundry Oct 02 '13 at 23:51
source share