I have an Objective-C iPad app I want to build an opaque static library from so I can give it to testers using X-code to test without giving them the source code. How can I do this?
views:
65answers:
4Objective-C is compiled, so just compile it and then distribute the binary.
Use a "Static Library" target. Add your source to the target, and build. Since Objective-C is compiled to machine code, the resulting library is binary only. That said, Objective-C binaries are not as difficult to dig into as C++, for example. Since Objective-C uses runtime dispatching, many symbol names are retained. Using classdump
at the command line, users will still be able to at least learn the classes and selectors in your binary. If this is unacceptable, you will have to consider writing the library in pure C (I discourage you from using C++ since it would require clients to use Objective-C++ just to use your library).
If you want the recipients to be able to test on both a device and the simulator, build a fat library. I liked this article on fat binaries.
A static library is not very useful by itself. You will probably want to copy your entire project, remove all headers and sources except main.m and add your static library. That way all the resources, frameworks, and build rules will remain in tact. Then send along the library, project, and all resources.
Unless there is a specific reason why you would want testers to access your application through XCode, you can instead build a binary for ad-hoc distribution that can be installed on up to 100 devices. Check up "Ad Hoc Distribution" for the iPhone.