I need to make a iOS static library (A) that include another library (B), but I don't have source code for library B. I only have a .a file and headers. Is it possible?
I created project with 2 targets, 1 - test target, 2 - target for library. How to add library B to target 2 correctly? I need only one library in result.
Static libraries don't link and are simply a collection of object files, however you can package the object files from both libraries into a single .a file.
You could write an Post Build Script on your static library Xcode target that combines both libraries by unpacking them and then recreating the new library, however getting the right paths (i.e. using the correct Xcode environment variables) could be tricky.
It's something like:
ar x libyours.a
ar x libtheirs.a
rm -f libyours.a
ar c libyours.a *.o
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With