I have a library (lib.a
) and a header file (lib1.h
). The problem is the library is too big and only a relatively small subset of users need it.
- Would it be possible to build my Xcode project without the library? Currently I get:
ld: library not found for -llib
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Would it be possible to guard against usage of the library not existing inside the Xcode project? I found the following, but I'm not sure if it's sufficient (assuming I can get the project to build without the lib):
if ([MyLibABC class]) { ... } else { NSLog(@"Add Lib.a"); }
Side note:
In Java I would use reflection to call methods implemented in the library (lib.jar
) and if the library is not present I would catch the ClassNotFoundException and show an error message or something (lib.jar missing, please consult the documentation).
I'm targeting >= iOS5.