I am working on UIDocumentPickerViewController() in Swift. After opening the document picker the files and images look blurred and I can't select any of them. I have attached the screenshot and the code below. Any idea why these files and images are not selectable?
extension BecomeMuftiTwoVC: UIDocumentPickerDelegate {
func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentsAt urls: [URL]) {
guard let selectedFilesURL = urls.first else {
return
}
let dir = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!
let sandboxFileURL = dir.appendingPathComponent(selectedFilesURL.lastPathComponent)
if FileManager.default.fileExists(atPath: sandboxFileURL.path) {
print("Already File Exist")
}
else {
do{
try FileManager.default.copyItem(at: selectedFilesURL, to: sandboxFileURL)
print("Copied Files")
}
catch{
print("Files Are not exist ")
}
}
}
}
//MARK: - Import File Btn Action
@IBAction func importFile(_ sender: Any) {
let documentPicker = UIDocumentPickerViewController(documentTypes: [KUTTypedPlainText], in: .import)
documentPicker.delegate = self
documentPicker.allowsMultipleSelection = false
present(documentPicker, animated: true, completion: nil)
