So you want to record/play something on iOS and now have to deal with AudioSession, categories, routing of audio etc. There is good documentation on apple website here. Information on that link can be very overwhelming for a first timer and then mistakes happen.
Here is a great lecture video which I found to be useful. WWDC 2010 session 412 Audio Development for iPhone OS part 1. You will need a developer account (which is free) with apple and iTunes to watch the video. I hope after listening to it you will feel better (I did) :).