Я загружаю zip-файл с сервера и распаковываю zip-файл в локальный каталог.
ie, /var/mobile/Containers/Data/Application/8A7B8DF1-AAA4-442E-99C9-82616FC3E192/Documents/assets.zip
Разархивируйте путь: / var / mobile / Containers / Data / Application / 8A7B8DF1-AAA4-442E-99C9-82616FC3E192 / Библиотека / Кэши / 47B7913E-A0B2-429D-AD91-AA3367EFB2AE
Из папки с архивом Мне нужно загрузить индекс. html в WkWebView. Но я смог найти папку, но не смог загрузить ее в веб-просмотр.
вот код для загрузки zip-файла и извлечения zip-файла в локальном каталоге:
let url = URL(string: v)
FileDownloader.loadFileAsync(url: url!) { (path, error) in
print("PDF File downloaded to : \(path!)")
guard let unzipPath = self.tempUnzipPath() else {
return
}
print("Unzip path:", unzipPath)
let success: Bool = SSZipArchive.unzipFile(atPath: path!,
toDestination: unzipPath,
preserveAttributes: true,
overwrite: true,
nestedZipLevel: 1,
password: nil,
error: nil,
delegate: nil,
progressHandler: nil,
completionHandler: nil)
if success != false {
print("Success unzip")
} else {
print("No success unzip")
return
}
var items: [String]
do {
items = try FileManager.default.contentsOfDirectory(atPath: unzipPath)
print("array item for unzip", items[0])
} catch {
return
}
for v in items[0] {
print("vv index.html", v)
self.buildAry.append(v)
}
print("build ary", self.buildAry)
let ss = self.buildAry[0]
print("index html", ss)
}
вот мой вывод на консоль:
Success unzip
array item for unzip build
vv index.html b
vv index.html u
vv index.html i
vv index.html l
vv index.html d
build ary 2020-02-07 19:40:44.480754+0530[9847:2135988] [Process] kill() returned unexpected error 1
["b", "u", "i", "l", "d"]
index html b
Как загрузить индекс. html в WKWebView из разархивированной папки. Любая помощь высоко ценится пожалуйста.