I am developing a Cocoa application and need to check whether the current OS X version is OS X 10.6 Snow Leopard
If the current version is Snow Leopard, I need to cl
There are a couple ways you could do this.
You could check for the existence of a 10.6 only class:
Class snowLeopardOnlyClass = NSClassFromString(@"NSRunningApplication");
if (snowLeopardOnlyClass != nil) {
NSLog(@"I'm running on Snow Leopard!");
}Use a system function (like Gestalt) to determine the OS version:
#importSInt32 major = 0; SInt32 minor = 0; Gestalt(gestaltSystemVersionMajor, &major); Gestalt(gestaltSystemVersionMinor, &minor); if ((major == 10 && minor >= 6) || major >= 11) { NSLog(@"I'm running on Snow Leopard (at least!)"); }