Database Reference
In-Depth Information
add strings such as “OK” and “Cancel.” It is, however, a thankless job, so it's probably
a good idea to rotate the work around to the various members of the team.
The biggest problem you're going to face is that you can't put XIB files in your libraries,
because only framework libraries can hold this kind of data, and Apple reserves to itself
the ability to create frameworks in iOS.
Libraries Aren't Entirely Useless!
So what are static libraries good for? As it turns out, quite a lot! For example, in the
application I developed, there is a lot of code around parsing XML returned from the
server, and the code that handles the network communications themselves. It is all
abstracted away from the UI, so it could easily by placed into a separate static library
that other iOS applications could use, and I could maintain it without stepping on (for
example) someone developing a new iPad application. You need to think out how you
want to divide up your application to avoid circular libraries dependencies, although
the @class hack can be used to handle class references between libraries, if you must.
This involves putting an @class annotation at the top of a header file to inform the
compiler that a class is defined in another file, without actually including that file. It's
the same way you avoid circular references to classes in header files.
The other advantage of static libraries is that it allows you to treat them differently,
from a build perspective. When might this be useful? Well, I recently converted our
application over to the automatic reference count compiler added in iOS 5. However,
I depend on several third-party packages that are problematic to convert over because
of the way they directly manipulate low-level system objects. I could have tried to puzzle
it out, but because of the licenses involved, I would have had to involve our legal de-
partment because I would have been required to contribute the changes back to the
open source projects involved. While I don't have a philosophical objection to doing
that, it was more hassle than I had time to deal with at the moment.
However, by putting each of the third-party libraries into their own static library, I was
able to choose at ARC conversion time whether or not I wanted each of the libraries to
be converted. By saying no, I was able to convert the main application without having
to modify the libraries.
There are other times when you might need different build settings for a library, such
as compiler optimization levels, additional compiler flags, etc. Static libraries let you
easily segregate portions of your application so that you can do just these kinds of
things.
You Can Still End Up Stepping on Each Other's Feet
The other headache you can run into is that, at the end of the day, there are still some
code paths that everyone is going to end up going through. For example, a main menu
that leads to the various subfunctions of the application will need to be modified by
each developer working on a subfunction, to enable access to that function. But this is
 
Search WWH ::




Custom Search