ios file:/// Users / ...和/ Users /之间有什么区别?

时间:2018-02-24 06:48:44

标签: ios swift

当我想要删除文件夹及其容器时,我发现了一个问题。

let urls = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)
let downloadDirectory:URL = urls.appendingPathComponent("Download")
let manager = FileManager.default

let pathString = downloadDirectory.absoluteString // file:///Users/...
let path = downloadDirectory.path // /Users/...

然后

let  directoryContents:[Any]? = try? manager.contentsOfDirectory(atPath: path)

运作良好,但

let  directoryContents:[Any]? = try? manager.contentsOfDirectory(atPath: pathString)

无法找到文件夹

0 个答案:

没有答案