Cannot open file from Files app in DocumentGroup App with other file open

Given a document-based app (MyApp) using DocumentGroup:

  1. If MyApp is not open, or it is open with the Document Browser displayed, and a file compatible with MyApp is tapped in the Files app, the tapped document opens as expected in MyApp.
  2. If MyApp is open and displaying a document, then tapping a compatible document in the Files app switches to MyApp, but fails to display the tapped document, and logs the following error:
[Presentation] Attempt to present <SwiftUI.UIKitNavigationController: 0x11c87dc00> on <SwiftUI.DocumentBrowserViewController: 0x129018a00> (from <SwiftUI.DocumentBrowserViewController: 0x129018a00>) whose view is not in the window hierarchy.

The problem is easily demonstrated by creating a new project from the Document App template in Xcode and running it in the simulator

  1. Run the app and create a new document (Untitled)
  2. Close Untitled and create another document (Untitled 2)
  3. Close Untitled 2
  4. Open Untitled
  5. Switch to the Files app, navigate to the MyApp folder and tap on Untitled 2

The error above will be shown in Xcode.

Does anyone have any insight into how to solve this?

Thank you

I don't know the answer to your question but I can confirm that my App is the same.

Cannot open file from Files app in DocumentGroup App with other file open
 
 
Q