Skip to content

Commit

Permalink
chore: make sure to select the foreground/active scene, not only the …
Browse files Browse the repository at this point in the history
…first
  • Loading branch information
hansemannn committed Feb 14, 2024
1 parent ef0d4c5 commit 3a42ce8
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion iphone/Classes/AppModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,18 @@ - (void)_resumeRestart:(id)unused
[TiLayoutQueue resetQueue];
#endif

UIScene *activeScene = UIApplication.sharedApplication.connectedScenes.allObjects.firstObject;
// Get the currently active scene
UIScene *activeScene = nil;
for (UIScene *scene in UIApplication.sharedApplication.connectedScenes) {
if (scene.activationState == UISceneActivationStateForegroundActive) {
activeScene = scene;
break;
}
}

if (activeScene == nil) {
NSLog(@"[ERROR] No active scene connected - this may lead to an undefined behavior");
}

/* Begin backgrounding simulation */
[appDelegate sceneWillResignActive:activeScene];
Expand Down

0 comments on commit 3a42ce8

Please sign in to comment.