var recordingSession : AVAudioSession!
recordingSession = AVAudioSession.sharedInstance()
try recordingSession.setCategory(AVAudioSessionCategoryPlayAndRecord, mode: AVAudioSessionModeDefault, options: [.allowBluetoothA2DP, .allowBluetooth, .defaultToSpeaker])
AirPod is connected playing music but no recording.
I tried to setPreferredInput to AVAudioSession. But that too didn't worked.
Thanks in advance.