If multiple input & output accessories are attached to iPhone, I want the user to be able to manually select the input & output source. I can manually select input by querying [[AVAudioSession sharedInstance] availableInputs] and then using setPreferredInput:error method in iOS 7, but I can not find anything similar for output. How do I achieve this ? I am using PlayAndRecord category.
Apple don't want developers to change the output route/volume programmically. Maybe MPVolumeView is your choice.
Add a MPVolumeView, and then set its showsRouteButton to YES.
The Apple Documentation says, "The route button is visible by default when there is more than one audio output route available."
Like this:

Edit: Although Apple don't want developers to change output route programically, sometimes we can still change output route forcefully when iPhone is not connected to headset/headphone:
AVAudioSession* session = [AVAudioSession sharedInstance];
[session overrideOutputAudioPort:AVAudioSessionPortOverrideSpeaker error:nil];
[session setActive:YES error:nil];
this takes effect only when iPhone is not connected to headset/headphone.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With