I would like to conditionally include code for an iPhone app depending on which version of the SDK I'm compiling against. On Mac OS X, there is the MAC_OS_X_VERSION_MIN_REQUIRED
preprocessor macro which gets set to the value of the MACOSX_DEPLOYMENT_TARGET
build setting by the compiler. Is there an equivalent on the iPhone?
Update:
I've set IPHONE_DEPLOYMENT_TARGET
to 3.0 in the build settings, but Xcode is passing -D__IPHONE_OS_VERSION_MIN_REQUIRED=20000
and -mmacosx-version-min=10.5
to GCC. Shouldn't the first one be 30000
and the second one be -miphoneos-version-min=3.0
? What am I doing wrong?
Update 2:
Looks like I wasn't doing anything wrong. __IPHONE_OS_VERSION_MIN_REQUIRED
and -miphoneos-version-min
are both set correctly when building for a device -- it's only wrong when using the iPhone Simulator SDK. I think it's a bug in the simulator SDK.