In a Cocoa application, I'd like to use conditional compilation, like:
#if MACOSX_DEPLOYMENT_TARGET <= MAC_OS_X_VERSION_10_4
[[NSFileManager defaultManager] removeFileAtPath:path handler:nil];
#else
[[NSFileManager defaultManager] removeItemAtPath:path error:NULL];
#endif
My hope is that this will avoid compiler warnings about removeFileAtPath: being deprecated when MACOSX_DEPLOYMENT_TARGET = 10.6, since it shouldn't be compiling that line.
It doesn't work.
When MACOSX_DEPLOYMENT_TARGET = 10.6 I get a warning that removeFileAtPath: is deprecated. But it shouldn't be compiling that line, so it shouldn't be warning about it having a deprecated method!
(I am setting MACOSX_DEPLOYMENT_TARGET in both the project build settings and the target build settings. I have BASE_SDK set to 10.6 and specify GCC 4.2 in both, too.)
What am I doing wrong? Do I have some fundamental misunderstanding of conditional compilation?