diff --git a/Ports/iOSPort/nativeSources/CodenameOne_GLAppDelegate.m b/Ports/iOSPort/nativeSources/CodenameOne_GLAppDelegate.m index 1ac0282466..6e7de3d60e 100644 --- a/Ports/iOSPort/nativeSources/CodenameOne_GLAppDelegate.m +++ b/Ports/iOSPort/nativeSources/CodenameOne_GLAppDelegate.m @@ -216,7 +216,12 @@ - (void)cn1ApplicationWillResignActive - (void)cn1ApplicationDidEnterBackground { #ifdef CN1_BLOCK_SCREENSHOTS_ON_ENTER_BACKGROUND - [[CodenameOne_GLViewController instance] eaglView].hidden = YES; + // Hide the view controller's root view rather than just the EAGL/Metal + // surface. Once a peer component is added with paintPeersBehindEnabled, + // the controller's view is a newRoot containing both eaglView and the + // peerComponentsLayer (BrowserComponent's WKWebView lives in the latter) + // -- hiding only eaglView leaves peers visible in the app-switcher snapshot. + [CodenameOne_GLViewController instance].view.hidden = YES; cn1IsHiddenInBackground = YES; #endif if(editingComponent != nil) { @@ -239,7 +244,7 @@ - (void)cn1ApplicationDidEnterBackground - (void)cn1ApplicationWillEnterForeground { if (cn1IsHiddenInBackground) { - [[CodenameOne_GLViewController instance] eaglView].hidden = NO; + [CodenameOne_GLViewController instance].view.hidden = NO; } // Clear before updateCanvas: viewWillTransitionToSize: and // didRotateFromInterfaceOrientation: use this to skip propagation during