0

I am trying to load a file from my applications documents directory using the following code, however, I am getting the error The folder “Documents” doesn’t exist.. Am I doing something wrong?

let paths =  FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)
var documentsUrl = paths[0]
do {
    let fileURLs = try FileManager.default.contentsOfDirectory(atPath: documentsUrl.absoluteString)
    print(fileURLs)
} catch {
    print(error.localizedDescription)
}
BenJacob
  • 957
  • 10
  • 31

0 Answers0