'Error Domain=SSZipArchiveErrorDomain Code=-1 "failed to open zip file" UserInfo={NSLocalizedDescription=failed to open zip file}

              _ = 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



Solution 1:[1]

It was an iOS version(14.3) issue.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 achinthaishane