compatibility 10.5 10.6

Discussion in 'Mac Programming' started by jtkim, Feb 21, 2011.

  1. jtkim macrumors newbie

    Feb 21, 2011
    I developed a program in OSX 10.6 SDK. And deployed to OsX 10.5. it did not work.

    So, I changed base SDK to 10.5 in XCode but many sources were not compiled, made many errors.

    For examples , NSApplicationDelegate protocol does not exists.

    And methods of NSPasteboard are different from 10.6.

    Do I have to change these sources according to 10.5 Spec?

    Is there anyway that one source covers both 10.5 and 10.6 ?
  2. foidulus macrumors 6502a

    Jan 15, 2007
    You need to read the Apple API documentation, every single class and method in there has a "since mac os 10.*" entry. Quite simply put there is no way they could make Leopard "forwards compatible" without essentially making it snow leopard, so there is bound to be classes and methods in 10.6 that don't exist in 10.6.

    If you want to make something that is compatible with both you need to pay attention to Apple's documentation and guidelines, end of story.
  3. balamw Moderator


    Staff Member

    Aug 16, 2005
    New England
    I think you know what to do:

    As foidulus says read the docs and adapt accordingly.

    You can probably wrap some of the code in a version check if the feature is desirable enough. Do it one way on 10.5 and another on 10.6.

  4. monsieurpaul macrumors regular

    Oct 8, 2009
    I had the same problem: An app developed on 10.6 didn't build with 10.5 SDK because NSApp Delegate and NSTextField Delegate are not implemented in 10.5. Quick and dirty fix:

    - Copy your whole App folder

    - Open the copied .xcodeproj file in Xcode, use the rename fonction. Personally I added "Leo" to the name of the app. Set the target to 10.5.

    - For the textfield delegate, I just removed the "<NSTextfield delegate>" string in the corresponding files headers and the delegate method (textControlDidChange) still worked. Don't ask me why.

    - For the NSApp delegate, it depends on what have you put in this file. In my example I used it only for the method "lastWindowCloseApp", so I removed the files.

    -Build was successful and app was functionnal. I lost the "lastwindowcloseapp" feature but this can be implemented differently.
  5. gnasher729 macrumors P6


    Nov 25, 2005
    You have three choices:

    1. Build using the 10.6 SDK and 10.6 deployment target. Runs on 10.6 only.

    2. Build using the 10.5 SDK. It works on 10.5 and 10.6 but you cannot use any 10.6 features.

    3. Build using the 10.6 SDK and 10.5 deployment target. Whenever you want to use a 10.6 feature you need to check at runtime whether the code is running on 10.5 or 10.6 and use the feature only on 10.6. Since your code will compile fine but crash on 10.5 if you get it wrong, it is best to have a target using 10.6 and a target using 10.5 and make your code compile on both. Your code would like like

    if (runningon10.6)
    use 10.6 code
    use 10.5 code

    If there are 10.6 features that are just there to make life easier for the programmer then don't use those features if you want to run on 10.5.

Share This Page