When I set:
[[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryPlayAndRecord error:NULL];
…recording and playing works
Don't forget the import statement. Perhaps obvious for the more experienced programmers...
#import