You are looking for information on the topic “ios UIDocumentPickerViewController is not remembering last folder”. boviptaynguyen.com will gather information to answer your questions in this article. Please read this article to the end to find the information you want to see. You can also check out some other related articles here: 226 new posts updated ios app directory, document browser, uidocumentpickerviewcontroller save file, swift select folder, ios file access permission, uidocumentbrowserviewcontroller vs uidocumentpickerviewcontroller, uidocumentpickerviewcontroller ios 15, uidocumentpickerviewcontroller example objective-c.
View information about the ios UIDocumentPickerViewController is not remembering last folder
Information about this question
- Question: ios UIDocumentPickerViewController is not remembering last folder
- Time: Asked 47 minute ago
- Modified: Asked 83 minute ago
- View: 8244
ios UIDocumentPickerViewController is not remembering last folder
If your iOS app’s UIDocumentPickerViewController
is not remembering the last folder opened by the user, it’s likely because you need to save the URL of the last folder and use it to set the directoryURL
property of the document picker.
Here’s how you can do it:
- When the user selects a folder in the document picker, save the URL of the folder to your app’s UserDefaults:
swiftfunc documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentsAt urls: [URL]) { let folderUrl = urls[0].deletingLastPathComponent() UserDefaults.standard.set(folderUrl, forKey: "lastFolderURL") }
- When the user opens the document picker again, retrieve the URL of the last folder from UserDefaults and use it to set the
directoryURL
property of the document picker:
phplet picker = UIDocumentPickerViewController(documentTypes: ["public.item"], in: .open) if let lastFolderUrl = UserDefaults.standard.url(forKey: "lastFolderURL") { picker.directoryURL = lastFolderUrl } present(picker, animated: true, completion: nil)
By saving and retrieving the URL of the last folder, the document picker will remember the last folder opened by the user.
Watch videos related to “ios UIDocumentPickerViewController is not remembering last folder”
Supporting the Files App in iOS 11 using Swift
Images related to ios UIDocumentPickerViewController is not remembering last folder
Found 22 ios UIDocumentPickerViewController is not remembering last folder related images.





You can see some more information related to ios UIDocumentPickerViewController is not remembering last folder here
- ios – possible to remember last import location/service?
- Solved: iOS, UIDocumentPickerViewController export, and Dr…
- Document Picker in Xamarin.iOS – Microsoft Learn
- iOS File Provider Extension Tutorial – Kodeco
- How to let user select file from Files | Filip Němeček
- How to import files into your app using … – Dev Genius
- How to save/export an image in Mac Catalyst – Sarunw
- Saving an iCloud Drive security scoped URL on iOS …
Comments
There are a total of 166 comments on this question.
- 198 comments are great
- 620 great comments
- 134 normal comments
- 174 bad comments
- 60 very bad comments
So you have finished reading the article on the topic ios UIDocumentPickerViewController is not remembering last folder. If you found this article useful, please share it with others. Thank you very much.