I am using a uIdocumentPickerViewController to upload a pdf file in firebase but when I try to upload it, I get an error saying that this file is not reachable.
Here is the code of the delegate of my uidocumentPickerViewController :
func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentsAt urls: [URL]) {
let storageReference = Storage.storage().reference()
print(urls.first!)
storageReference.child((urls.first?.deletingPathExtension().lastPathComponent)!).putFile(from: urls.first!, metadata: nil){(_, err) in
if err != nil {
print((err?.localizedDescription)!)
return
}
print("success")
}
}
Here is the mistake I get after choosing my pdf file :
File at URL: file:///private/var/mobile/Containers/Shared/AppGroup/7BE40C45-A4B5-4EE0-8AFF-789B2F93C1F6/File%20Provider%20Storage/Document%20PDF.pdf is not reachable.
Domain=NSCocoaErrorDomain Code=257 xcode