FileManager cannot find audio file

三世轮回 提交于 2019-12-02 05:16:32

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)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!