views:

35

answers:

4

Hello,

I tried to use the ZipKit framework (http://bitbucket.org/kolpanic/zipkit/wiki/UsingZipKit) in the test application for iPad. I followed the "Traditional way" of the installation (as it is described on their page) with no success. Hope somebody can help me with it:

1/ I used hg to get sources
2/ I build the ZipKit project (Release build)
3/ After doing this there was created in the build folder the new ZipKit.framework folder
4/ I have created a new test project for the iPad 3.2 (XCode 3.2.4)
5/ I have drag&dropped the ZipKit.framework folder created in the step 3) into Frameworks section on my new test project
6/ In Targets section I have created new Copy File Build Phase and I drag&drop the ZipKit.Framework from Frameworks section to the new Copy Files folder.
7/ Then I build and run the project.

The project cannot be even started, it is being closed after I press the project icon - so I must do something terribly wrong. In the console output I can see the error - it is pretty clear what is missing, but I do not know what to do with that... Might be some XCode expert or someone, who used the ZipKit can help me - this must some really stupid mistake I am doing...

There is the console output:

dyld: Library not loaded: @rpath/Frameworks/ZipKit.framework/Versions/A/ZipKit
  Referenced from: /Users/sten/Library/Application Support/iPhone Simulator/3.2/Applications/3C51FC4F-0E85-48D2-BC68-D01ADD73DAE1/ZipExample.app/ZipExample
  Reason: image not found
Failed to launch simulated application: iPhone Simulator failed to find the process ID of com.yourcompany.ZipExample.

BTW - I have tried to run the ZipKit Touch example provided with the framework and it works perfectly...

Thanks a lot BR STeN

There is the screenshot of my test project - on the left side you can see the ZipKit.framework I drag&drop into my project:

alt text

A: 

You should go back and read it again.

The "traditional way" is not the right way to do this - Apple don't allow iOS applications with external frameworks like this - you want to link against the static library instead using the process described under "Static Library Target".

Jeff
Hi, thanks for the reply! So all I was doing was wrong? Both the "Traditional way" and the "Better approach" are for MAC OS X and I should use the "Static Library Target" way? It will be nice to express this on build pages - it might be clear for someone more experienced then me... I have just spend 2 days on this:(( Thanks for the reply, STeN
STeN
A: 

Hi,

I have tried also the "Better Way" as described here http://bitbucket.org/kolpanic/zipkit/wiki/UsingZipKit. I tried to follow all steps, but the description is not too 100% clear to me. Anyway I was able to build the project and call the following code copied from example provided in the ZipKit Touch demo application:

NSString *archivePath = [[NSBundle mainBundle] pathForResource:@"ZipKitTest" ofType:@"zip"];
ZKDataArchive *archive = [ZKDataArchive archiveWithArchivePath:archivePath];
[archive inflateAll];

Unfortunately it crashes in the 2nd line of the code with the following error:

2010-10-20 05:11:10.625 ZipExample[10123:207] *** -[NSCFString zk_precomposedUTF8Length]: unrecognized selector sent to instance 0xd1c4
2010-10-20 05:11:10.630 ZipExample[10123:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSCFString zk_precomposedUTF8Length]: unrecognized selector sent to instance 0xd1c4'
2010-10-20 05:11:10.633 ZipExample[10123:207] Stack: (
    42252368,
    43410220,
    42261083,
    41723510,
    41720306,
    34016,
    280046,
    187797,
    34629,
    12364,
    22833,
    13639,
    7175,
    2980164,
    2984271,
    3009854,
    2991351,
    3023320,
    51245436,
    41531548,
    41527464,
    2982433
)
terminate called after throwing an instance of 'NSException'

There is a screenshot of my XCode project:

alt text

Hope someone could figure out the problem.

Thanks a lot BR STeN

STeN
You look to have both libzipkit.a and libtouchzipkit.a selected. That means you are linking against both ARM and X86 code.
Jeff
And you don't need to *copy* either file - they are statically linked into your app, not dynamically loaded. Remove them from the Copy Files phase.
Jeff
Thanks to all of you for your help. The ZipKit works perfectly on the iPad. I am in our application downloading 50-200MB zip files and then I'm unpacking them. Even with files of such size I have no problems with memory... Great Job!!! Regards,
STeN
A: 

I've updated the Using ZipKit page to make it clear which ZipKit target should be used for what type of product.

kolpanic
You might also want to clarify the need to link against libz.dylib - its a bit hidden in some of the screen snaps.
Jeff
Good point. Done.
kolpanic
A: 

Is there a basic page which shows some simple code for inflating and deflating files and directories for ZipKit?

UPDATE: I figured this out but it was a scavenger hunt:

NSString *filePath = [userDocumentsDirectory stringByAppendingPathComponent:@"newFile.zip"];

ZKFileArchive *archive = [ZKFileArchive archiveWithArchivePath:filePath];
[archive deflateDirectory:exportDirectory relativeToPath:nil usingResourceFork:NO];
indigosplinter