Document browser app in iOS 15 keeps creating iCloud drive folder

474 views Asked by At

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:

  • Create a new project in Xcode 13.0
  • Choose iOS -> Document App
  • Choose Interface: Storyboard and create the project (for simplicity let’s use “MyApp” as Product Name)
  • Build and install MyApp on a device running iOS 15.0 or 15.0.1 with iCloud Drive enabled
  • Leave the default setting for Document Storage (i.e. iCloud Drive) in Settings -> MyApp
  • Create a text file with any content and save it with extension “exampletext” (i.e. the imported type identifier used by the app template - let’s call the file “test.exampletext”)
  • Send an email to an inbox accessible from the device with test.exampletext as attachment
  • Open Mail on the device, long-press on test.exampletext and share it to MyApp
  • If a folder “MyApp” exists in iCloud Drive, it will be renamed to “MyApp 2”; a new “MyApp” folder will be created and test.exampletext will be saved in the new folder
  • Sharing again test.exampletext from the mail to MyApp will create another “MyApp” folder and rename the previous one; an arbitrary number of “MyApp n” folders can be created in this way, each including one copy of the document
1

There are 1 answers

0
cvb On BEST ANSWER

This is fixed in the 15.2 beta.