views:

298

answers:

1

I'm looking for a macro that specified the exact version of the iPhone SDK used for compilation. This is needed because when compiling with (and only with) SDK 3.0, I need to add some additional code.

__IPHONE_OS_VERSION_MIN_REQUIRED is not the right choice here, since it can be set by the user with parameter -mmacosx-version-min. For example, a user can compile with min version -mmacosx-version-min=3.0 in SDK 3.1, so a check for __IPHONE_OS_VERSION_MIN_REQUIRED == 30000 would be true, even if the user is compiling with SDK 3.1.

Any help is appreciated.

Regards, Jochen

A: 

You can use the following macros

#ifdef __IPHONE_3_0

    NSLog(@"iPhone OS Ver is 3.0");

#else

     NSLog(@"Not iPhone OS 3.0");

#endif
Biranchi
__IPHONE_3_0 is also defined in iPhone SDK 3.1, so this does not work.
Jochen