Warning: This answer applies to iOS6 only. It is not correct for iOS7 or later. See comments for details.
This is possible, but only with a side effect. Changing the input device also changes the output device. You will not be able to record through the internal mic and at the same time listend to your recording in realtime through the headset's headphones. That means that if you do not want to listen simultaneously to your recording through the headphones, there is a solution for you:
When having connected a headset (= combined headphones and mic), you can choose between two alternatives:
- internal mic for input and speaker for output
- headset's mic for input and headset's headphones for output
(You can not use a mixture of these.)
You choose one of the alternatives by setting the property kAudioSessionProperty_OverrideAudioRoute through the function AudioSessionSetProperty of the Audio Session Services API. The documentation of the property says:
If a headset is plugged in at the time you set this property’s value
to kAudioSessionOverrideAudioRoute_Speaker
, the system changes the
audio routing for input as well as for output: input comes from the
built-in microphone; output goes to the built-in speaker.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…