How do I still play sound the iphone(ipod touch) is locked but my program is running?
How do I still play sound the iphone(ipod touch) is 开发者_StackOverflowlocked but my program is running?
Depending on how you are playing a sound, setting the audio session type to media player before you start playing sound and before the device is locked may help.
[[AVAudioSession sharedInstance] setDelegate: self];
// Use this code instead to allow the app sound to continue to play when the screen is locked. [[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryPlayback error: nil];
精彩评论