Xcode: how to build a static library project correctly?

This question will be easy for Xcode professionals, but for the MonoTouch developer this cannot be resolved. :-)

I am using Xcode 4.5 and I want to configure iOS 5.1 and higher and iOS Simulator 5.1 and higher.

I have a library project here, and it comes with a prebuilt binary name named "DemoLib" (no extension and 11 MB in size). The library is a thick lib for Simulator and iOS 5.1+. I can use this library without any problems. However, if I try to create the library myself, I get the file "DemoLib.a" (note the extension and size of 30 MB). How can I get the same build result? What is a .a file compared to a file without an extension? I tried to build the project โ€œto runโ€ and โ€œto archiveโ€ in Xcode. Both results in the same file 30 MB .a. I was expecting some drop-down list in Xcode where you could select the assembly "DEBUG" or "RELEASE", and the second - to create a smaller library.

+7
source share
2 answers

Of course, I could not say without seeing the framework project file. Having said that, there is a great guide for creating and compiling iOS frameworks: https://github.com/jverkoey/iOS-Framework

Using the above guide, you can recreate your project from scratch, add the files you have, and compile it correctly.

Hope this helps! :)

+3
source

Did it come with a makefile? Create a new target, set the build parameters for the target in that in the Makefile, and then set your project to depend on this new target.

A .a file is a static library, which means that it is independent of the external and all necessary code. I think that no extension at all implies a dynamic library, which means that it will depend on some dependencies present in your system in order to link them. Maybe that's why .a is so much more. I think Xcode will create static ones by default, because iOS does not allow the use of dynamic libraries.

Drop-down list to build in your schema. Command + Shift + <to view your diagram. Within the framework of the scheme, you can edit which environment each construction method will use.

0
source

All Articles