I made a little library for the IPhone that I would like to redistribute, but I cannot find how to compile it to work on both the simulator and the iphoneos. I know there is a way to build a lib.a for both architecture, but I cannot figure it out.
views:
434answers:
4Set 'Valid Architectures' setting of the Xcode target to both i386 and the one of the iPhone (that I don't know which is, maybe someone will suggest).
First you obviously have to put your code into a framework. That is fine for linking into your application that exists in the same project, but as you've noticed the iPhone doesn't support dynamic linking.
One of my libraries available on google code has a script that builds a Custom SDK for the iPhone and iPhone Simulator. I put the scripts to do that in the following StackOverflow answer. That also has the link to the code, so you can download and play with settings in the project if the post is not enough.
This is a kind of batching multiple build work. So scripting is suitable and regular solution.
Key concept is mixing command xcodebuild
and lipo
.
Please refer my answer on this question: http://stackoverflow.com/questions/3520977/build-fat-static-library-device-simulator-using-xcode-and-sdk-4/3616733#3616733