Viktor Maric
Viktor Maric

Reputation: 603

SwiftUI Document-based app error: "The document could not be opened"

I am building a document-based app with SwiftUI, but whenever I want to create a document in the app, the app shows the alert: "The document could not be opened"

I hit the same problem with Apple's sample project.

The interesting part is that I only get this error message when I am creating a new file from the "Recents" tab, but when I am creating it from the "Browse" tab, then it works.

The beta testers from my app are also experiencing this issue, and they use multiple different OS versions, and they have enough storage to create the files.

Upvotes: 2

Views: 234

Answers (2)

ninjudd
ninjudd

Reputation: 563

I was able to fix this by adding the following to my Info.plist

<key>UISupportsDocumentBrowser</key>
<true/>

Upvotes: 1

Peter
Peter

Reputation: 815

I have also experienced the very same problem on an iOS-only target. However, if I compile the same codebase as a multiplatform target and run it on iOS, the issue disappears.

Upvotes: 0

Related Questions