I have a library (guess what that is!) for use in the iPhone. For the library I have an XCode project with two targets. One for the emulator and one for the actual device. Nothing wild as you can see.
However the joy came when I desided to also use the library in OSX. As one would guess I went on and created a new target for OSX, which started out as a copy of the original iPhone, target but with the “base SDK” for the specific target switched to “Mac OS X 10.6”.
When I compiled for the first time, I came to the realization that even with this option set to Mac OS X 10.6, xcode was still compiling for the iPhone! From this point on, nothing worked. I tried every option, setting, for the project and the target.. but nothing. XCode seemed locked to compile for the iPhone, totally ignoring the SDK setting. I ended up trying quiting/starting again XCode, restarting the MAC… and some other arcane spells and voodoo I can’t really confess here… nothing… Then I gave up and dreamed of the nice days of scons and even make files, when you knew what was under the hood..
All that until today when in a moment of enlightenment, I clicked on the “Overview” dropdown of XCode with the ALT key pressed. And “boom” (as Jobs would say), there is was… “the choise”! By holding ALT when selecting the “Overview dropdown, XCode allows you to choose the active SDK! This was so overwhelming for me that I tweeted about it and also desided to make a blog post, so that no one has to go through what I did.
So bottom line for both OS X and iPhone targets:
- Make a new target for OS X and set it up.
- ALT-click the Overview to select your active SDK.
- Compile.
- Have a nice day!