With iOS10 there are more possibilities to manage AUdioSession, but i couldn't manage to keep the headphone microphone as input while audio is going out through the iphone speaker.
The 'overrideOutputAudioPort' method below also override the input audio port as the iphone microphone
let session = AVAudioSession.sharedInstance()
do {
try session.setCategory(AVAudioSessionCategoryPlayAndRecord)
try! session.overrideOutputAudioPort(.speaker)
} catch {
}
Is there any solution to keep the headphone as input?