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

satyam90

macrumors regular
Original poster
Jul 30, 2007
242
0
Bangalore, India
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?
 

Eraserhead

macrumors G4
Nov 3, 2005
10,434
12,250
UK
Well you have to build it against the appropriate SDK, why not just stick with the 10.4 methods?
 

Soulstorm

macrumors 68000
Feb 1, 2005
1,887
1
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.

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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.