The Gestalt() function located in CarbonCore/OSUtils.h
has been deprecated as of OS X 10.8 Mountain Lion.
I often use this function to test the version of the OS X operating system at runtime (see the toy example below).
What other API could be used to check the OS X operating system version at runtime in a Cocoa application?
int main() {
SInt32 versMaj, versMin, versBugFix;
Gestalt(gestaltSystemVersionMajor, &versMaj);
Gestalt(gestaltSystemVersionMinor, &versMin);
Gestalt(gestaltSystemVersionBugFix, &versBugFix);
printf("OS X Version: %d.%d.%d
", versMaj, versMin, versBugFix);
}
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…