swifticloud-driveios15uidocumentbrowserviewcontroller

Document browser app in iOS 15 keeps creating iCloud drive folder


I have had a document browser app up since iOS 11 (using UIKit/UIDocumentBrowserViewController). The app (let's call it "MyApp") used to create a "MyApp" folder in iCloud Drive (and/or on the device, depending on the choice made in Settings), where documents would be saved automatically.

After updating my device to iOS 15 and recompiling, without any changes to the code, the app seems not to recognize its own folder in iCloud Drive anymore. Every time a file is opened/imported from outside the app (Files, Mail, etc.), the app creates a new "MyApp" folder in iCloud Drive and saves the document there. The existing folder is renamed "MyApp 2" (and then "MyApp 3", "MyApp 4" etc. if I try to import another document).

This seems to happen only in iCloud Drive. If I choose in Settings to save documents on my device, all documents are automatically imported into the "My App" folder, as it was the case in iOS 14 and earlier.

I also tried to create a test app from scratch using the Xcode 13 UIKit document-based app template, and the behavior seems to be exactly the same... so it looks like a bug in UIDocumentBrowserViewController was introduced with the iOS update.

Did anyone notice the same? Is there a solution/workaround? Should a bug report be filed?

Thank you for your help.

[EDIT] If anybody is interested, this is the simplest way to reproduce the issue using the Xcode template:


Solution

  • This is fixed in the 15.2 beta.