How do I prevent the iPhone screen from dimming or turning off while my application is running?

Objective-C

[[UIApplication sharedApplication] setIdleTimerDisabled:YES];

Swift

UIApplication.shared.isIdleTimerDisabled = true

Leave a Comment