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://*.com/questions/6492038/find-mac-os-x-version-number-in-objective-c

上一篇:React Router的Route的使用


下一篇:centos7 ops