1
              _ = try? SSZipArchive.unzipFile(atPath: filePath, toDestination: downloadPath.absoluteString!, overwrite: true, password: nil, progressHandler: { log, info, count, total in
                print("file",log)
                print("info", info)
                print("first", count)
                print("second", total)
            }, completionHandler: { zipPath,success,error in

                if success == true {
                    print(zipPath)
                    let filePaths = FileManager.default.urls(for: URL(string: downloadPath.absoluteString!)! )

                    completionHandler(true, filePaths)
                } else {
                    print(error)
                }

            })

Entered downloadPath.url instead of downloadPath.absoluteString but not working. This works fine on simulator, error comes when it's running on device.

ERROR COMES FROM COMPLETIONHANDLER

achinthaishane
  • 77
  • 1
  • 2
  • 9
  • Which line fails exactly? What are `filePath` and `downloadPath` value? – Larme Oct 14 '21 at 07:11
  • @Larme error comes from completion handler, filePath is the zip file and downloadPath is the unzipped file. – achinthaishane Oct 14 '21 at 07:16
  • It's just that using `filePath` which look like how? and `downloadPath.absoluteString` are strange. It's not the same logic. Also, I'd tend to say that `filePath` might be wrong. – Larme Oct 14 '21 at 07:19
  • @Larme Then how it's working on simulator perfectly? – achinthaishane Oct 14 '21 at 07:21
  • Sometimes Simulator is more "tolerant"... Could be that? But if `downloadPath` is in fact an `URL`, I would have called `downloadPath.path` instead of `download.url` or `download.absoluteString`. – Larme Oct 14 '21 at 07:24

1 Answers1

-1

It was an iOS version(14.3) issue.

achinthaishane
  • 77
  • 1
  • 2
  • 9