Permalink
Browse files

IOS: Only change idle timer from main thread.

This prevents various runtime warnings i.e.
"Main Thread Checker: UI API called on a background thread:
-[UIApplication setIdleTimerDisabled:] ..."
  • Loading branch information...
jonnyijapan authored and digitall committed Sep 13, 2018
1 parent 4034497 commit 58f3aac49ece050ddd3f5a51b4033a1bcadc08a7
Showing with 6 additions and 2 deletions.
  1. +6 −2 backends/platform/ios7/ios7_osys_video.mm
@@ -64,13 +64,17 @@ static void displayAlert(void *ctx) {
void OSystem_iOS7::engineInit() {
EventsBaseBackend::engineInit();
// Prevent the device going to sleep during game play (and in particular cut scenes)
[[UIApplication sharedApplication] setIdleTimerDisabled:YES];
dispatch_async(dispatch_get_main_queue(), ^{
[[UIApplication sharedApplication] setIdleTimerDisabled:YES];
});
}
void OSystem_iOS7::engineDone() {
EventsBaseBackend::engineDone();
// Allow the device going to sleep if idle while in the Launcher
[[UIApplication sharedApplication] setIdleTimerDisabled:NO];
dispatch_async(dispatch_get_main_queue(), ^{
[[UIApplication sharedApplication] setIdleTimerDisabled:NO];
});
}
void OSystem_iOS7::initVideoContext() {

0 comments on commit 58f3aac

Please sign in to comment.