To enable simultaneous recording and playback, you need to set an appropriate audio session category. This is covered in the Audio Session Programming Guide.
If you need help setting up the actual recording and playback, you'll want to read the Core Audio Overview as well.