Thursday, August 25, 2011

Retrieve Mac OS Version Programmatically


It may be a needed thing to check the version of the Client device that your program is running on it, as It may help you to implement a custom Task for the new OS only

Here are the code I found for this, 

#import <CoreServices/CoreServices.h>

  SInt32 major, minor, bugfix;
  Gestalt(gestaltSystemVersionMajor, &major);
  Gestalt(gestaltSystemVersionMinor, &minor);
  Gestalt(gestaltSystemVersionBugFix, &bugfix);

  NSString *systemVersion = [NSString stringWithFormat:@"%d.%d.%d",major, minor, bugfix];