I am using Objective-Zip in a mixed Swift/Objective-C project, and I cannot get currentFileInZipInfo()
to work. It isn't available in autocomplete, and if I try to type it manually I get an error Value of type 'ZipFile' has no member 'currentFileInZipInfo'
. I've imported ZipFile.h
into my bridging header, and other methods do appear and compile without error so I'm pretty sure it's all hooked up correctly.
Here's the code in question:
let zipFile = ZipFile(fileName: "myFile.zip", mode: ZipFileModeUnzip)
if let unzippedFile = zipFile, unzippedFile.numFilesInZip() == 1 {
unzippedFile.goToFirstFileInZip()
let info = unzippedFile.currentFileInZipInfo() // error here
}
Why would some of the methods be available, but not others?
Eventually figured it out on my own. The problem was that the method returns an object from another file that I hadn't imported (FileInZipInfo.h
), and for some reason the compiler decided that the best way to deal with that was to pretend that the method didn't exist. Once I imported the other file, everything worked fine.