问题
Possible Duplicate:
AVAudioRecorder doesn't record while screen is locked
I'm trying to get my audio recorder to keep working even when the iphone is locked like apple's Voice Memos app. Currently the lock button seems to call for my recorder to stop.
What can I do to keep the recorder on even when the screen is locked until the user actually stops it manually?
回答1:
You need configure AVAudioSession Category.
NSError *sessionError = nil;
[[AVAudioSession sharedInstance] setDelegate:self];
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryRecord error:&sessionError];
You can find more information here
来源:https://stackoverflow.com/questions/12477958/avaudiorecorder-stops-when-lock-button-is-pressed