Search code examples
iosiphonetarunzipphp-ziparchive

unzOpen returns null while unzipping tz file in iphone


I am using ZipArchive to unzip tz files in my iphone App. It works fine when I have a sample tz file which contains text files inside it. However, my main usage is to try to unzip a tz file containing Json files. When I try to do that nothing happens as I am not able to access my file and I am not coming to a conclusion regarding to what am I doing wrong here?

Only thing I have come to know is this

_unzFile = unzOpen( (const char*)[zipFile UTF8String] );

This line of code returns me a proper _unzFile and works fine with the sample .tz file which contains .txt files. However, when I try it with my .tz file which contains a json file in it, _unzFile contains nothing (i.e 0x0). Is there any problem with UTF8String function? Or else what am I doing wrong?

Please help! Thanks.


Solution

  • Generally it is the problem of the zip file to be uncompressed. In my condition, I used some other files, compress them manually and decompress them with the code, the unzOpen works properly. I used ASIHTTPRequest, downloaded and renamed the zip file, I suppose it could be made wrong here. Therefore, check the zip file itself please.