Unzip

Discussion in 'iOS Programming' started by yaniv92648, Jul 12, 2010.

  1. macrumors member

    Joined:
    Oct 26, 2009
    #1
    Hi,
    i have a url inwhich there's a zip file i wanna unzip. i tried zlib, gzip, NSDataCategory (the methods zlibInflate, gzipInflate) and more..
    but without success. i would like please a simple example of converting a zip file (NSData *) to an unzipped file (NSData *).
    Thank u very much.
     
  2. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    What has failed about the approaches you have tried. Post the code that you have tried and explain in each case exactly what failed and where.
     
  3. thread starter macrumors member

    Joined:
    Oct 26, 2009
    #3
    Examples

    NSData *zippedFile = [NSData dataWithContentsOfURL:[NSURL URLWithString:url]]; // works well

    zippedFile size: 1543 Bytes

    unZippedFile should be about 5.5 KB

    i imported zlib, gzip, minizip, ZipArchive and NSDataCategory:

    NSData *zippedGzipDeflate = [zippedFile gzipDeflate];
    NSData *zippedGzipInflate = [zippedFile gzipInflate];
    NSData *zippedZlibDeflate = [zippedFile zlibDeflate];
    NSData *zippedZlibInflate = [zippedFile zlibInflate];

    zippedGzipDeflate.length = 1566 Bytes
    zippedGzipInflate.length = 0 Bytes
    zippedZlibDeflate.length = 1554 Bytes
    zippedZlibInflate.length = 0 Bytes

    i also tried ZipArchive: UnzipFileTo, UnzipOpenFile.

    http://stackoverflow.com/questions/412982/iphone-unzip

    http://www.iphonedevsdk.com/forum/i...ctive-c-class-zip-unzip-zip-format-files.html

    http://stackoverflow.com/questions/1546541/how-can-we-unzip-a-file-in-objective-c

    http://forums.macrumors.com/showthread.php?t=750332

    http://www.flyblog.info/catprogramming/202.html

    http://www.iphonekicks.com/objectivec/Objective_C_class_for_zip_unzip_zip_format_files

    i feel like it's right under my nose and i can't find how 2 do it...
     
  4. Guest

    TZRaceR6

    Joined:
    Jun 8, 2010
    Location:
    United Kingdom
    #4
    I use a program called Stuffit. You can do a google search on it to find out about it. You have to pay for the full version, but there is a trial version for free.
     
  5. thread starter macrumors member

    Joined:
    Oct 26, 2009
    #5
    i don't understand u

    i wanna do it programmatically through objective-c code
     
  6. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #6
    This is about iPhone Programming and programmatically unzipping a file. A Mac OS application is totally irrelevant.

    Edit: Just as a test can you unzip the file correctly with the Mac OSX unzip in The Finder?
     
  7. thread starter macrumors member

    Joined:
    Oct 26, 2009
    #7
    Yes.

    when i paste the url in the address bar it automatically downloads, unzips the file and open the unzipped file.
     
  8. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #8
    OK, so it's unlikely to be a problem with the file itself. Are there any messages printed to the console? Do you have the source to the unzip methods you are using? If so step through in the debugger and check what's going on.
     

Share This Page