This is a mirror of official site: http://jasper-net.blogspot.com/

Xcode: The complete explanation on how to use static libraries.

| Tuesday, May 4, 2010
It won’t take so long to follow the tutorial…

After writing the complete tutorial i was a little bit worried that it was too big or that it would take to long for people to read it all through, however, i followed the whole tutorial all over and it actually doesn’t take that long at all. The whole tutorial takes in between 8 to 12 minutes to complete.
So what are static libraries and why would i want to use them?

When you are developing you always have pieces of code that are convenient and usable in different projects, or you have for example a piece of code that accesses something in the same manner which could be used for various projects of the same kind (for example the code for communicating with a high score server which can be used by all sorts of games).

Now there are a number of ways on how to go about this, one method could be to just simple copy the code to a project every time you need it. One big downside to this is that every project has a copy of the code and pretty soon all the various copies are different, or even worse, you found a bug and need to change it in twenty different projects.

A better solution would be to keep the code in a separate project so that all maintenance on that code can be done in one single spot. This is where a static library comes in, you can create a static library project and link the library into the various projects. Now in our case we will not only link the library but actually the complete static project to our normal project. The reason for this is that a compiled ‘product’ is specific for it’s environment, so when you compile a static library project for a simulator / debug target it cannot be used in a deployment to a physical device. Linking the project itself has the advantage that when you change the compile target for your own project it will be automatically be delegated to the static library project. When you now compile your own project it will automatically compile the static project along with it.

Read more: Sodeso

Posted via email from jasper22's posterous

0 comments: