iPhone - Using a static Library?
I created a static library project which gene开发者_如何学JAVArates an "a" file. I included this "a" file to another project as a static library.
The only way I could use the classes in this static library was to copy all header filed over as well as the "a" file.
Is it possible to avoid copying the header files, and still be able to use and import classes from this static library?
The best option I could find is here:
http://www.cocoanetics.com/2010/05/making-your-own-iphone-frameworks-in-xcode/
...basically, you can jump through a few hoops to package your static library as a Framework. The Framework will create an internal copy of your header files, so you get access to them automatically when you include it in your project.
Not really, you have to declare the functions somewhere visible to the caller. Header file is the most convenient way to do it, because it provides an interface. A possible approach is to merge those headers into one .h file, so you provide a single and complete interface with your library.
The only other approach I can think about is declaring the functions in the files where you call them, but this is much more devastating and error prone then including a header file.
精彩评论