How to get the OS X system version?

后端 未结 8 1915
一整个雨季
一整个雨季 2021-01-31 11:45

I want to get the OS X system version, such as: 10.5.4, 10.4.8, etc. I want to get it in my app, how do I do this? Thanks!

8条回答
  •  一向
    一向 (楼主)
    2021-01-31 12:24

    NSString *osver()
    {
        SInt32 versionMajor=0, versionMinor=0, versionBugFix=0;
        Gestalt(gestaltSystemVersionMajor, &versionMajor);
        Gestalt(gestaltSystemVersionMinor, &versionMinor);
        Gestalt(gestaltSystemVersionBugFix, &versionBugFix);
        return [NSString stringWithFormat:@"%d.%d.%d", versionMajor, versionMinor, versionBugFix];
    }
    

提交回复
热议问题