weixin_39616961
weixin_39616961
2021-01-11 23:09

Failed to open zip file

Hi, I use this code to unzip my file on iPhone, but when library try to open zip file on local folder I receive this error message:

Unzip error -1 - failed to open zip file

This is my code:

 swift
/** Method that unzip file */
    func unzipFile(pathOfZippedFile: String, pathWhereUnzipFile: String) {
        // Unzip
        SSZipArchive.unzipFileAtPath(pathOfZippedFile, toDestination: pathWhereUnzipFile, progressHandler: {
            (entry, zipInfo, readByte, totalByte) -> Void in


            Logger.logDebug("readByte : \(readByte)")
            Logger.logDebug("totalByte : \(totalByte)")


            //Asynchrone task
            dispatch_async(dispatch_get_main_queue()) {
                Logger.logDebug("readByte : \(readByte)")
                Logger.logDebug("totalByte : \(totalByte)")

                //Change progress value

            }
            }, completionHandler: { (path, success, error) -> Void in
                if success {
                    //SUCCESSFUL!!
                    Logger.logDebug("Unzip success")
                } else {
                    Logger.logDebug("Unzip error \(error.code) - \(error.localizedDescription)")
                }
        })
    }

该提问来源于开源项目:ZipArchive/ZipArchive

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

4条回答

为你推荐

换一换