Xcode: iPhone Project Dependency on Mac OS X Project
This week, while building an iPhone application for a client, I wanted to run a custom Mac OS X command-line utility during the build phase of the iPhone project. I set up the command-line utility as a dependent project of the iPhone project, but it won’t build, telling me:
target specifies product type ‘com.apple.product-type.tool’, but there’s no such product type for the ‘iphonesimulator’ platform
There is no perfect solution to this problem, but here’s my workaround: rather than let Xcode build the dependent project for me, I simply added a call to xcodebuild as part of my custom script phase. As long as the input and output files for this phase are set up properly, the entire phase is skipped when the output file is up-to-date, and xcodebuild is pretty fast when the target binary is already built, too.
My final script phase looks like this:
(cd SubProject; xcodebuild -configuration Release) SubProject/build/Release/SubProjectCommand |
The only way I’ve been able to get around the “target specifies product type ‘com.apple.product-type.tool’” message has been to force the Active SDK. You can do so by pressing “Option” and clicking on the top-left dropdown in Xcode. It’ll display a lot more options, and you can select Mac OS X 10.5. That may allow you to run the command line utility in the Xcode iPhone project.
I think this was an issue that appeared in Xcode 3.2.3
http://www.cocoabuilder.com/archive/xcode/289469-single-project-with-mac-and-iphone-targets.html