AVAudioRecorder stops when lock button is pressed [duplicate]

本小妞迷上赌 提交于 2019-12-24 18:50:32

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!