…although of course it’s not quite that simple. The old method is actually deprecated, and produces warnings, so in fact I think it’ll need to dynamically check which method is available on the current OS. PITA.
It actually builds clean. You only get a deprecated warning if the MIN is set to 10.6 or 10.7 and you try to use the old call. In this case, you are not trying to compile those calls unless the deployment version matches.
FWIW, those OS defines have always made my head throb. Same with the platform defines in the Windows DDK.
Notice that I didn’t just change MAX to MIN, but also ALLOWED to REQUIRED. The problem is that when the deployment target is the same as the base SDK, MAC_OX_X_VERSION_MIN_ALLOWED doesn’t get defined. So in your case, the #if was failing and you were getting the #else, which is wrong for 10.7, hence the warning. I had the deployment target set to 10.5, so I built clean and got the old style call, even with the 10.7 SDK building on Lion.
With the above, A deployment target of 10.6 and above gets the new flavor, below gets the old. Both should build without warnings (they do here).
I won’t have access to a 10.5 machine again until Monday to try your code, but it seems like it would always run the dynamic test version when building with SDKs 10.6 or newer and only hit the #else case when building with older SDKs.
Sorry I missed the ALLOWED earlier. That’s bit me before.
FWIW, I get why Apple has the _ALLOWED thing, since folks will compile their code against different SDKs. But something about the _REQUIRED naming, which derives directly from deployment target always confuses me, and I’ve read the Apple guide multiple times.