我已经使用 iexplorer 在我安装的应用程序文档目录中复制了一个视频文件,我试图通过访问该视频在 avplayer 上播放它。但我找不到该视频。这是我的代码,用于在应用程序文档目录下查找文件
var paths: [AnyObject] = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)
var documentsDirectory: String = paths[0] as! String
do {
let filePathsArray: [AnyObject] = try NSFileManager.defaultManager().subpathsOfDirectoryAtPath(documentsDirectory)
print("files array %@", filePathsArray)
}catch {
}
显示为空
最佳答案
来自苹果文档:
subpathsOfDirectoryAtPath:error:
Performs a deep enumeration of the specified directory and returns the paths of all of the contained subdirectories.
尝试迭代 .contentsOfDirectoryAtPath:error
关于ios - 在应用程序文档目录中查找文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37882541/