Post

Replies

Boosts

Views

Activity

UIDocumentPicker Error on accession selected file
I have an issue on importing files into my app when selected by the user through UIDocumentPickerViewController. The error I get is: Error Domain=NSPOSIXErrorDomain Code=13 "Permission denied". I'm testing on iPhone 11 with iOS 13.5.1. This is my implementation: func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentsAt urls: [URL]){                  urls.forEach { (url) in                          let access = url.startAccessingSecurityScopedResource()             var error: NSError? = nil             NSFileCoordinator().coordinate(readingItemAt: url, error: &error) { (coorURL) in             do{                     let gZippedData = try Data(contentsOf: url)                     print(gZippedData)                     if access{                         url.stopAccessingSecurityScopedResource()                     }                 }catch{                     print(error.localizedDescription)                 }                     }                 }             }         }     } The value of access is true. why I can't access the file? what am I missing? Thank you for your help.
5
0
4.4k
Jul ’20