Disable the screen Lock when audio recording iOS

Solution:

If you are recording the audio when your app is on use and don't had any actions performed only recording will happen then if your screen lock time is some seconds that time screen will be locked.

So try the below code code to disable the screen lock when audio is recording.When audio record started the call the below code.

Objective C:

[UIApplication sharedApplication].idleTimerDisabled = YES;

Swift:


 UIApplication.shared.isIdleTimerDisabled = true


In didfinishrecording call the below code

Objective C:

[UIApplication sharedApplication].idleTimerDisabled = No;

Swift:


 UIApplication.shared.isIdleTimerDisabled = false


Comments

Popular posts from this blog

Invalid bundle error while upload the app to the app Store

Convert NsNumber, NSDate to String in iOS Swift

Global LocationManager Singleton class iOS Swift