tags:

views:

59

answers:

1

Hi all. I'd like to be able to tell at compile time if I'm compiling for iPhone SDK 2.x or 3.x, so I can leave out some bits (e.g. MapKit, GameKit) if need be. Currently I'm doing this using a custom #define. I'm wondering if there is a way of detecting this automatically from the active SDK? I know about TARGET_OS_IPHONE and TARGET_IPHONE_SIMULATOR, and TargetConditionals.h, but could not find anything related to the active SDK.

+2  A: 

Have a look at Availability.h (and AvailabilityInternal.h). There's __IPHONE_OS_VERSION_MIN_REQUIRED defined there as well as constants for SDK version.

Vladimir