我尝试使用ZipArchive框架解压缩 zip 文件,但我不明白这个问题。它没有告诉我一些错误,但我找不到解压缩的文件/文件夹。
// Unzip
let sourceURL = localUrl.stringByAppendingPathComponent(path: "TEMP.zip")
let destinationURL = localUrl.stringByAppendingPathComponent(path: "TEST")
SSZipArchive.unzipFile(atPath: sourceURL, toDestination: destinationURL)
编辑:有了上面的答案,这里是错误信息:
Error Message: Error Domain=SSZipArchiveErrorDomain Code=-1 "failed to open zip file" UserInfo={NSLocalizedDescription=failed to open zip file}
EDIT2:我检查了函数fileExists,并且文件可用
let str = sourceURL
let url = URL(string: str)
print(url!.path,"\n")
if FileManager.default.fileExists(atPath: url!.path) {
print("FILE IS AVAILABLE")
} else {
print("FILE NOT AVAILABLE")
}
提前致谢