LzmaSDKObjC
LzmaSDKObjC copied to clipboard
Unarchive .7z file works randomly - LZMA DEBUG 72: ERROR: code = 1,
Hi,
I am trying to download file and unarchive it in my app. The problem is that sometimes Lzma works perfectly but most of the time I am getting this error in console:
LZMA DEBUG 72: ERROR: code = 1, file = '/Users/piotrek/Development/zarazjade_mac/Pods/LzmaSDK-ObjC/src/LzmaSDKObjCFileDecoder.cpp', line = 146, description = Can't open archive file with result: 1 Can't open archive: Can't open archive file with result: 1
There is a code that unzip my file:
guard let fileURL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first else { return }
let reader = LzmaSDKObjCReader(fileURL: fileURL.appendingPathComponent(lastFile.name), andType: LzmaSDKObjCFileType7z)
reader.delegate = self
reader.passwordGetter = {
return ""
}
do {
try reader.open()
var items = [LzmaSDKObjCItem]()
reader.iterate(handler: { (item, error) -> Bool in
items.append(item)
return true
})
if reader.extract(items, toPath: "/Users/piotrek/Documents/", withFullPaths: true) {
print("Extract failed: \(reader.lastError?.localizedDescription)")
}
} catch let error as NSError {
print("Can't open archive: \(error.localizedDescription) ")
}
I will be glad for help.
Hi, please provide test archive file.
I am facing same error when using with React Native App.
@OlehKulykov
It's due to use_frameworks
How we can use it with RN?