Given a document-based app (MyApp) using DocumentGroup:
- 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.
- 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
- Run the app and create a new document
(Untitled) - Close
Untitledand create another document(Untitled 2) - Close
Untitled 2 - Open
Untitled - Switch to the Files app, navigate to the
MyAppfolder and tap onUntitled 2
The error above will be shown in Xcode.
Does anyone have any insight into how to solve this?
Thank you