Chuyển tới nội dung
Trang chủ » Ios Uidocumentpickerviewcontroller Is Not Remembering Last Folder Top 6 Posts With The Most Views

Ios Uidocumentpickerviewcontroller Is Not Remembering Last Folder Top 6 Posts With The Most Views

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:

  1. When the user selects a folder in the document picker, save the URL of the folder to your app’s UserDefaults:
swift
func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentsAt urls: [URL]) { let folderUrl = urls[0].deletingLastPathComponent() UserDefaults.standard.set(folderUrl, forKey: "lastFolderURL") }
  1. 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:
php
let 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.

Ios - Choose Destination When Saving File - Stack Overflow
Ios – Choose Destination When Saving File – Stack Overflow
Ios - Uidocumentpickerviewcontroller - All Files Grayed Out - Stack Overflow
Ios – Uidocumentpickerviewcontroller – All Files Grayed Out – Stack Overflow
Ios - Displaying Folder Names From Uidocumentpickerviewcontroller - Stack  Overflow
Ios – Displaying Folder Names From Uidocumentpickerviewcontroller – Stack Overflow
Ios - Ios13 Uidocumentpickerviewcontroller - Open Directory Does Not  Display Select/Open/Cancel Buttons - Stack Overflow
Ios – Ios13 Uidocumentpickerviewcontroller – Open Directory Does Not Display Select/Open/Cancel Buttons – Stack Overflow
Ios - Uidocumentpickerviewcontroller Files Disabled? - Stack Overflow
Ios – Uidocumentpickerviewcontroller Files Disabled? – Stack Overflow

You can see some more information related to ios UIDocumentPickerViewController is not remembering last folder here

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.

Trả lời

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *