Backwards Compatibility between new OSs (10.7) and Older Ones (10.6)

Discussion in 'Mac Programming' started by Littleodie914, Jul 14, 2011.

  1. Littleodie914 macrumors 68000

    Littleodie914

    Joined:
    Jun 9, 2004
    Location:
    Rochester, NY
    #1
    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! :)
     
  2. Blakeasd macrumors 6502a

    Joined:
    Dec 29, 2009
    #2
    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
    }
    
     
  3. ShortCutMan macrumors member

    Joined:
    Aug 8, 2005
    #3
    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.
     
  4. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
  5. Littleodie914 thread starter macrumors 68000

    Littleodie914

    Joined:
    Jun 9, 2004
    Location:
    Rochester, NY
    #5
    That's exactly what I was looking for. Thanks :)
     

Share This Page