首页 > 代码库 > mac 下获取 os x 的系统版本,使用 oc cocoa

mac 下获取 os x 的系统版本,使用 oc cocoa

mac 下获取 os x 的系统版本,使用 oc cocoa

1:

#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];

 

2:

NSDictionary *systemVersionDictionary =    [NSDictionary dictionaryWithContentsOfFile:        @"/System/Library/CoreServices/SystemVersion.plist"];NSString *systemVersion =    [systemVersionDictionary objectForKey:@"ProductVersion"];

 

参考:http://stackoverflow.com/questions/6492038/find-mac-os-x-version-number-in-objective-c

mac 下获取 os x 的系统版本,使用 oc cocoa