How would I be able to get the OSX version in objective-c? I would like to avoid using shell commands. E.g "10.5" or "10.4"
+1
A:
NSProcessInfo *pinfo = [NSProcessInfo processInfo];
NSString *version = [pinto operatingSystemVersionString];
Sorry for the formatting, I'm using my iPad to answer this.
ennuikiller
2010-09-12 14:16:51
That's fine if you want to display the version to the user, but not fine if you want to do processing based on the OS version.
JeremyP
2010-09-12 16:56:41
I'll look into this, thanks for the answer!
alexy13
2010-09-12 21:44:29
This works, but there is a lot of "garbage" text that is added with it (Build information etc).
alexy13
2010-09-13 09:42:48
+1
A:
You can use the Gestalt
function to access the components of the OS version.
Old-time users of Gestalt
may be amazed to find that it is still available in 64-bit.
Peter Hosey
2010-09-12 18:48:41