How to determine MAC OS X version (10.5,10.6,10.7) from Cocoa? [duplicate]
Possible Duplicate:
Find M开发者_开发技巧ac OS X version number in objective c
My application needs to be run on (10.5,10.6,10.7) . I have some different implementation pieces for each of them. So I want to be able to check OSX version from my APP.
How can I do it?
What is the best way to do that? Is there any function like if([osx version])...?
P.S. I'm aware of this question How can I determine the running Mac OS X version programmatically? I just couldn't find what I want for all that 3 versions.
Thanks a lot
I use gestalt in one of my Apps succesfuly. Some code snippet to check wether the user is running 10.7.0 or higher:
SInt32 OSXversionMajor, OSXversionMinor;
if(Gestalt(gestaltSystemVersionMajor, &OSXversionMajor) == noErr && Gestalt(gestaltSystemVersionMinor, &OSXversionMinor) == noErr)
{
if(OSXversionMajor == 10 && OSXversionMinor >= 7)
{
// Foo
}
}
精彩评论