• 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
Right way to check system version?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Right way to check system version?


  • Subject: Right way to check system version?
  • From: Ron Fleckner <email@hidden>
  • Date: Fri, 19 May 2006 17:47:04 +1000

Hi,

I was wondering whether this was a good enough way to see what system my app is running on. I need to see if it's running on Jaguar to decide whether to set up a particular UI widget, because I know it won't work properly on Jaguar.

Here's what I did:

// See if we're running on Jaguar:
NSString *sysVersionPlistPath = @"/System/Library/CoreServices/ SystemVersion.plist";
NSFileManager *fm = [NSFileManager defaultManager];
if ([fm fileExistsAtPath:sysVersionPlistPath])
{
NSDictionary *sysPlistDict = [NSDictionary dictionaryWithContentsOfFile:sysVersionPlistPath];
NSString *prodVers = [sysPlistDict objectForKey:@"ProductVersion"];
NSScanner *versionScan = [NSScanner scannerWithString:prodVers];
float version;
[versionScan scanFloat:&version];
if (version < 10.3)
[self setIsJaguar:YES];
else
[self setIsJaguar:NO];
} else {
[self setIsJaguar:NO];
}


I'd like to think there is a simpler, more direct way. I looked at Gestalt in the docs, but found this at the end of the section about System Version Selector:

A better way to obtain version information in Mac OS X is to read the system version information from the following file:

/System/Library/CoreServices/SystemVersion.plist

Never infer the existence of certain hardware or software features from the responses that Gestalt returns when you pass it this selector.

I don't know any Cocoa programmers so that's why I'm asking here.

Thanks in advance,

Ron Fleckner
_______________________________________________
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


  • Follow-Ups:
    • Re: Right way to check system version?
      • From: Steve Checkoway <email@hidden>
  • Prev by Date: Re: Variable scope/lifetime of class methods (concerns Threads)
  • Next by Date: Re: How can I create a PDF document from a string in a non-GUI application?
  • Previous by thread: Re: How can I create a PDF document from a string in a non-GUI application?
  • Next by thread: Re: Right way to check system version?
  • Index(es):
    • Date
    • Thread