XCode Mac OS X compatibility setting
I just created a small program in XCode 4 for Mac OS X. I want it to run on 10.4, 10.5 and 10.6. How can I do that? I am currently running Snow Leopard. In XCode 4, if I click my project, there's a settings for deployment Target, which is a drop down list and I can only select 1 of : 10.4, 10.5 or 10.6. How can I make sure it is compatible with all o开发者_JS百科f them? Thanks.
The deployment target is the minimum version you want to be compatible with. Set it to 10.4.
Since you have to use the 10.6 SDK with Xcode 4, you’re responsible for making sure you don’t use any APIs that aren’t available in 10.4 without testing for them first. You also can’t build PowerPC-compatible apps with Xcode 4.
build with 10.4
You will also want to build it in 10.6 also to make sure that you aren't using anything that has or will become deprecated... warnings will be thing that will become deprecated, errors will already be deprecated, you may have to do some conditional compilation. to keep things straight.
#if MAC_OS_X_VERSION_MIN_REQUIRED == MAC_OS_X_VERSION_10_4
//do something using 10.4 code
#elsif MAC_OS_X_VERSION_MIN_REQUIRED == MAC_OS_X_VERSION_10_5
//do something using 10.5 code
#else
//do something using 10.6+ code
#endif
精彩评论