Filemanager Cannot Find Audio File

FileManager cannot find audio file

You cannot save a sandboxed file URL or path string for later use, because the sandbox can move. You need to do what you were doing before, successfully: calculate the documents directory URL and then examine it. You should work entirely with URLs and never call absoluteString at all; it is the wrong call entirely and is letting you down here.

In this example, I check the documents directory for any files whatever:

let documentsDirectory = 
FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0]
let results =
try? FileManager.default.contentsOfDirectory(at: documentsDirectory,
includingPropertiesForKeys: nil)

Error when trying to copy file

This is possible when the destination path is missing the directory.
Make sure that the place at which you want to copy the source file is containing all required directory.



Related Topics



Leave a reply



Submit