Checking System Version
Checking System Version
- Subject: Checking System Version
- From: Philip Dow <email@hidden>
- Date: Mon, 1 Aug 2005 13:17:54 +0200
Hiya
I'd like to check for the system version from within Cocoa. I am
building my app using the 10.4 frameworks but deploying for 10.3 and
above, weak linking in the process. There are situations where I'd
like to take advantage of newer classes, specifically NSViewAnimation
and NSPredicate, but I need to check the system version before using
them.
Right now I am importing "/usr/include/objc/objc-runtime.h" and
calling objc_lookUpClass([@"NSViewAnimation" cString]) at init to
check for the view animation. If it exists, I set a bool in user
defaults that tells me the system is 10.4. Although this works, it
seems sloppy. Is there a better way?
I found an excellent article over at cocoadevcentral that documents a
couple of options. I could check the NSAppKitVersionNumber, however,
even in my 10.4 frameworks, the highest constant defined by
NSApplication.h is NSAppKitVersionNumber10_3_5. That won't do.
Alternately, I could call Gestalt() from within the Carbon frameworks
and check that the version returned is greater than 0x1040. I like
this better than what I'm doing now, but I have to add the carbon
frameworks.
Is there a way to check for 10.4 from within the Cocoa frameworks?
-Phil
http://phildow.net
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden