I use AVAudioPlayer for several iOS applications, and they all play successfully after locking the screen until iOS6 (or iOS5) on my iPad2, now they stop. Here's how I set it up, which worked fine:
Please note that I set the category to AVAudioSessionCategoryPlayback, which was the fix recommended earlier. This does not work since I upgraded to iOS6 - it also does not work on iOS5, as it turns out!
Update: I found an answer that works based on this post: AVAudioPlayer stops playing on the screen lock, even if the category is AVAudioSessionCategoryPlayback
Basically, I went to the "Information" page of the target and added a new key, "Necessary background modes", to this I added a value like the line type "Application plays audio." Now he makes his way through the track before turning off the screen completely.
source share