• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Checking System Version
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Checking System Version


  • Subject: Re: Checking System Version
  • From: glenn andreas <email@hidden>
  • Date: Mon, 1 Aug 2005 11:01:07 -0500


On Aug 1, 2005, at 6:17 AM, Philip Dow wrote:

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?


NSClassFromString(@"NSViewAnimation") != NULL


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?

The advice in the past has always been to check for specific features, and not system versions (as a more modern example, you might have WebKit installed by having Safari installed, even on systems that didn't ship with WebKit).


I'd just check for the classes work from there (note that there may be examples where the classes existed in older system, but weren't exposed, and have changed since then, which would cause problems).

Regardless, make sure that you properly test the different systems to make sure things work like you expect.


Glenn Andreas email@hidden <http://www.gandreas.com/> wicked fun! quadrium | build, mutate, evolve | images, textures, backgrounds, art

_______________________________________________
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


References: 
 >Checking System Version (From: Philip Dow <email@hidden>)

  • Prev by Date: Re: Checking System Version
  • Next by Date: Probably dumb question...
  • Previous by thread: Re: Checking System Version
  • Next by thread: Re: Checking System Version
  • Index(es):
    • Date
    • Thread