Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Littleodie914

macrumors 68000
Original poster
Jun 9, 2004
1,813
8
Rochester, NY
This is the first time I've had to "migrate" an app from one version of Mac OS X to another. In the past, I had been compiling an app on 10.5. Everybody on 10.5 used it. When I started compiling for 10.6 (I waited until 10.6.3), I dropped support for 10.5, easy squeezy.

Is there a common method for developers to implement new features for OS N, while still maintaining compatibility in the same binary for OS N-1?

I want to avoid adding Lion features (full-screen mode, etc.) if there's no way for those apps to also run under Snow Leopard. How do developers handle this?

Thanks! :)
 

Blakeasd

macrumors 6502a
Dec 29, 2009
643
0
Code:
#if MACOSX_DEPLOYMENT_TARGET == MAC_OS_X_VERSION_10_7

//Lion stuff

#else

 //Snow Leopard stuff

#endif

or
Code:
#if MACOSX_DEPLOYMENT_TARGET < MAC_OS_X_VERSION_10_7
if (![someObject respondsToSelector:@selector
(LionFeatureMethod:)])
{
    // Pre 10.7 stuff here
}
else
#endif
{
    // 10.7 stuff here
}
 

ShortCutMan

macrumors member
Aug 8, 2005
41
0
The above won't work in the same binary since the preprocessor operations are done at compile time. However using respondsToSelector: is what I have seen in reference to supporting multiple versions of iOS.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.