Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unarchive .7z file works randomly - LZMA DEBUG 72: ERROR: code = 1, #38

Open
piotrekjeremicz opened this issue Mar 14, 2019 · 2 comments

Comments

@piotrekjeremicz
Copy link

piotrekjeremicz commented Mar 14, 2019

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.

@OlehKulykov
Copy link
Owner

Hi,
please provide test archive file.

@ErHarinderSingh
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants