iOS_ZIP-KIT_ZipKit_Framework_Xcode_tutorialOne of the i3Factory developer is working on a project of sending paths attaching photos, text, and audio / video which needs to import a framework library for zipping files.
He found that this library seems to be constantly updated (usually found only those “no arc” for iOS4 ..) .

In ZipKit is present a brief guide to the installation, but Claudio, our Italian developer, finds it extremely superficial and not riescito to import anything (that is ZipKit.framework libtouchzipkit.a remain the “reds“). Inside Zip Kits are also linked apps that should be an example, but unloading the one for iOS and trying to start it now Build Failed”. Our developer is still inexperienced on how to integrate projects on other projects and setting dependencies.

Let us then explain how the whole mechanism, what needs to touch, what not, etc.

First of all, given that the project is for iOS is necessary to exclude the Framework (the Framework exist only for OSX and have been introduced in the last WWDC only iOS8 and now to create a Framework iOS7 must follow a fairly intricate process explained here:
So the static library of interest and the libtouchzipkit.a (and the otherthe static library for OSX).
Our CTO, Carlo Vigiani, proceeded in this way and was able to compile a simple project (ZKtest da scaricare qui that uses the class ZKFileArchive (we did not try the result, but I assume that it works).

Hoping that this explanation will be helpful, import projects is not always obvious:
1) Open the project containing the application
2) To clone from github the whole project ZipKit and copy the entire project folder within your project (this step is not necessary but recommended so you’re sure to have the version of ZipKit right for your project ).
3) from the Finder, drag the file into the folder ZipKit.xcodeproj of the project (see figure: Charles has created an app ZKTest)

4) At this point you have to end up in the target Build Phases of your app (in the figure ZKTest) libraries that you will use: here I added libz.dylib (system) and libtouchzkpkit.a (given that you have to see that you’ve uploaded the project ZipKit as a sub-project of the main project); see Figure

5) also so that you can see the headers you need to add the header path is the path where ZipKit. If in step (2) avevevato copied the folder under the project ZipKit inside the main project folder, you only need to add. / ZipKit. In our case given that Charles did not copy the project must discover the absolute or relative path with respect to its project. Typically Charles goes like this:
5.1) in XCode select the sub-project (in this case ZipKit)

ZipKit_Test-35.2) nell’assistant XCode recover the path of the sub-project to the main project (see figure): in this case was .. /.. / Frameworks / Date / ZipKit / ZipKit.xcodeproj

5.3) now. H file is the main ZipKit.h that is located just below the directory you just searched, and then we go to our main target, we select Build Settings and Header Search Path and add the path previously found (see figure)


5.4) also we look for the section “Other Linker Flags” and add ObjCall_load” (see figure)

At this point the project (ZKtest download it here) and ready. Where we need to import the file “ZipKit.h” (note that we have indicated ZipKit / ZipKit.h given that the header file is located two levels below ZipKit header path than we had indicated before ../../Frameworks/Data/ZipKit/ZipKit/ZipKit.h

#import “ZipKit/ZipKit.h”
In general you have to keep these things in mind when you import a project:
  • headers needed for the compiler to check the correctness of your code and generate the binary code that calls functions; the header search path by default points to the project and the framework of system, so it’s up to you to manually add additional header search path
  • even if you have entered the correct header, then the linker will have to find the binary code associated with the functions you referenced: iOS, since there are no frameworks (at least until iOS7), you must load the static libraries (which are then copied to the application and statically loaded along with the rest of the track of the app): you can specify the static libraries in the Build Phases –> Link binary with libraries
  • You can optionally add in the “Target Dependenciestarget touchzipkit”: this ensures that the compilation of your code should always be preceded by the compilation of the original library: this and useful if you make changes to the event, in this case forced the generation of the target . Probably you will not do this if ZipKit compiled separately and then do not touch it anymore. But realize that this issuggested in case you have decided to support several architectures or change SDK (compilation assures you that there is no incompatibility). This of course should not be done if you provide a library without source code (for example, Urban Airship or Google Analytics does not give you the source code and therefore do not need to add the project in the target dependencies).