I'm having the same issue too. I need to get the MP4 file path from a local file.
It worked for me:
change URL(string: path) to URL(fileURLWithPath: path)。
example:
if let path = filePath {
let URL = URL(fileURLWithPath: path) // let URL = URL(string: path)
do {
let data = try Data (contentsOf: URL, options: .alwaysMapped)
print(" data: (data.count)")
} catch let error {
print(" data nil")
}
}