Cocoa programming according to OSX Version

Discussion in 'Mac Programming' started by satyam90, Apr 3, 2008.

  1. macrumors regular

    satyam90

    Joined:
    Jul 30, 2007
    Location:
    Bangalore, India
    #1
    In Cocoa using Obj C programming"
    I found some of the methods like NSFileManager's "createDirectoryAtPath:withIntermediateDirectories:attributes:error:" works only with OSX 10.5 and above. There are few other methods similar to that. In my application, I want to check the OSX Version and depending on the version, I want to implement the code accordingly. Is it possible to check the OSX version programatically and implement the code?
     
  2. macrumors G4

    Eraserhead

    Joined:
    Nov 3, 2005
    Location:
    UK
    #2
    Well you have to build it against the appropriate SDK, why not just stick with the 10.4 methods?
     
  3. macrumors member

    Joined:
    Oct 13, 2005
  4. thread starter macrumors regular

    satyam90

    Joined:
    Jul 30, 2007
    Location:
    Bangalore, India
    #4
    I visited above site before posting the question. But it consists only upto 10.3.5 , but I am looking to have differences between 10.4 and 10.5

    I am planning to migrate from 10.4 to 10.5 and so if my code consists of functions that can be used directly that works on 10.5, it might work faster.
     
  5. macrumors 68000

    Soulstorm

    Joined:
    Feb 1, 2005
    #5
    Actually, in the above link I also see some code that will return the exact version of the system. It's the code that uses Gestalt.

    Also, functions such as the one you describe are added for ease of use and to improve functionality, not performance. Check the documentation. Unless Apple says that a method is deprecated. you can use it and be sure that it will work on the current system and at least in the next major revision of OS X. So, you can use "createDirectoryAtPath:attributes:error" without worrying about having to use one or another. This function will work on OS X 10.0 and later.

    It's best not to implement version-specific code until you really need to. If you really need to implement a function because it allows you to do something that otherwise you couldn't, then you should do it. Otherwise, you tend to break compatibility with earlier versions of OS X, and to restore it, you will need to write more error-prone code.

    Just a thought.
     

Share This Page