开发者

How to determine MAC OS X version (10.5,10.6,10.7) from Cocoa? [duplicate]

This question already has answers here: Closed 11 years ago.

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
    }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜