Skip to content

Instantly share code, notes, and snippets.

@maximbilan
Last active August 29, 2015 14:25
Show Gist options
  • Save maximbilan/d081d7058ef0c5b06d27 to your computer and use it in GitHub Desktop.
Save maximbilan/d081d7058ef0c5b06d27 to your computer and use it in GitHub Desktop.
iOS: idleTimerDisabled = YES works until UIImagePickerController was used
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[self dismissViewControllerAnimated:YES completion:^{
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[UIApplication sharedApplication].idleTimerDisabled = YES;
});
}];
}
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {
self dismissViewControllerAnimated:YES completion:^{
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[UIApplication sharedApplication].idleTimerDisabled = YES;
});
}];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment