I am using SSZipArchive library to create password protected zip file. I have already done with unzip file where i didn't face any trouble. But when it's came to creation of zip file with password protection , it's not working at all.
let filePath = Bundle.main.path(forResource: "bg2", ofType: "jpg", inDirectory: "ZipFile")
if filePath != nil{
var paths = NSSearchPathForDirectoriesInDomains(FileManager.SearchPathDirectory.documentDirectory, FileManager.SearchPathDomainMask.userDomainMask, true)
let documentsDir = paths[0]
let zipPath = documentsDir.appendingFormat("/MyZipFiles") // My folder name
let fileManager = FileManager.default
let success = fileManager.fileExists(atPath: zipPath) as Bool
if success == false {
do {
try! fileManager.createDirectory(atPath: zipPath, withIntermediateDirectories: true, attributes: nil)
}
}
let stat = SSZipArchive.createZipFile(atPath: zipPath, withFilesAtPaths: [filePath!], withPassword: "bt123")
print(stat)
}
While printing the value of stat which one the method createZipFile is returning, i am getting as false. but in this same way i already have done with unzip a zip file. so, please help me.
Thanks in advance.