Black Screen After Dismissing Modal Controller

Hey All,

Been digging around the internet looking for this one, and while stackoverflow has some relevant solutions, none are working for me.


My View Hierarchy is the following


View

--->UISplitViewController.view ( set as a child viewController )

--------> rootViewController.view (set as the mainViewController of the splitView)

--------> detailViewController.view (set as the detailViewController of the splitview)


Via the iPhone 6 simulator(split view is always collapsed) I present a modal viewcontroller with the following code:


    UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:viewController];
    [navigationController.navigationBar setBarStyle:UIBarStyleBlack];
    [navigationController setModalPresentationStyle:UIModalPresentationPopover];

    navigationController.popoverPresentationController.sourceView = view;
    navigationController.popoverPresentationController.barButtonItem = barButtonItem;
    navigationController.popoverPresentationController.delegate = self;

    [self presentViewController:nav animated:YES completion:nil];


I dissmiss the presented controller from that viewController by calling:

[self dismissViewControllerAnimated:true completion:nil];


If I set animated to "false" I dont have any problems, but it looks bad and doesnt make sense.


I see some posts regarding this and custom presenatation methods, but Im not using anything custom here.


Any Help is appreciated!


EDIT:

On iPhone the ModalPresentationStyle should default to UIModalPresentationOverFullScreen, so I tried setting the presentationStyle directly to that, and it worked!

If I set the presentationStyle to "FullScreen" I get the same behavior, a black screen after dismissing.

Unfortunately, the presentation of a Fullscreen iAD, and subsequent dismissal, unloads the entire view structure from the application. As I cannot set the presentation style on this to "over fullscreen" I'm stuck.

I have started to experience this in AppKit (Cocoa for macOS) app development on BigSur. Here's a typical scenario:
  1. User launches the app

  2. Clicks the tiny green button in the upper-left of main window title bar to make app fullscreen.

  3. Presses cmd + ',' or (manages to reach the Preferences menu item while in full-screen mode)

  4. Preferences window pops up as a modal window (via: contentViewController..presentAsModalWindow(preferencesViewController)

  5. Prefs view appears fullscreen with an animation (sliding in from right to left)

  6. User closes the prefs window pressing OK or Cancel (both of which end up firing self.dismiss() where self is the preferencesViewController)

  7. A huge black blank screen in complete nothingness - the only way to gid rid of it is quitting the application with cmd + Q

Number 7 only occurs on BigSur and not in previous versions of macOS (tested as with as low as 10.13)



Black Screen After Dismissing Modal Controller
 
 
Q