Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
iOS keep sleep timer from enabling
// Prevent sleep
[NSTimer scheduledTimerWithTimeInterval:2.0 repeats:YES block: ^(NSTimer * _Nonnull timer) {
[UIApplication sharedApplication].idleTimerDisabled = NO;
[UIApplication sharedApplication].idleTimerDisabled = YES;
NSLog(@"idle timer");
NSLog(@"Initializing python");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment