AVAudioRecorder doesn't record while screen is locked

前端 未结 3 2027
长情又很酷
长情又很酷 2020-12-12 00:14

I\'ve tried to overcome this for a while. I\'m trying to record sound, but the AVAudioRecorder doesn\'t record while screen is locked. It does continue to record once screen

3条回答
  •  离开以前
    2020-12-12 00:27

    How about disabling the screen lock until you are done recording?

    [UIApplication sharedApplication].idleTimerDisabled = YES;
    
    // Do recording here
    
    [UIApplication sharedApplication].idleTimerDisabled = NO;
    

    Just don't forget to re-enable the screen lock when you're done!

提交回复
热议问题