• 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
Getting Current System Version
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Getting Current System Version


  • Subject: Getting Current System Version
  • From: Dan Saul <email@hidden>
  • Date: Sat, 9 Apr 2005 23:16:52 -0500

Hello there, I am having trouble getting my code to detect the current
operating system using Gestalt, I am running 10.3.

NSProcessInfo Category:

typedef enum {
        TRUnknownVersion = -1,
        TRCheetahVersion = 0,
        TRPumaVersion = 1,
        TRJaguarVersion = 2,
        TRPantherVersion = 3,
        TRTigerVersion = 4
} TROperatingSystemVersion;

+ (TROperatingSystemVersion)operatingSystemVersion
{
        long response;

        if (Gestalt(gestaltSystemVersion,&response) != noErr)
        {
                return TRUnknownVersion;
        }

        switch (response)
        {
                case 0x1000:
                {
                        return TRCheetahVersion;
                        break;
                }
                case 0x1020:
                {
                        return TRJaguarVersion;
                        break;
                }
                case 0x1030:
                {
                        return TRPantherVersion;
                        break;
                }
                case 0x1040:
                {
                        return TRTigerVersion;
                        break;
                }
        }
}

Code I am using to test it:

- action:(id)sender
{
        switch ([NSProcessInfo operatingSystemVersion]) {
                case TRUnknownVersion: default:
                {
                        NSLog(@"Unknown");
                        break;
                }
                case TRCheetahVersion:
                {
                        NSLog(@"10.0");
                        break;
                }
                case TRPumaVersion:
                {
                        NSLog(@"10.1");
                        break;
                }
                case TRJaguarVersion:
                {
                        NSLog(@"10.2");
                        break;
                }
                case TRPantherVersion:
                {
                        NSLog(@"10.3");
                        break;
                }
                case TRTigerVersion:
                {
                        NSLog(@"10.4");
                        break;
                }
        }
}

It always ends up telling me that it is 10.0 (or 0 basically) no
matter how I create the enum'd value. I haven't had much experiance
with Gestalt but it seems like I am doing the correct things,
unfortunately I can't test the current AppKit version or I would.

Thanks, Dan.
 _______________________________________________
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: Getting Current System Version
      • From: Shaun Wexler <email@hidden>
    • Re: Getting Current System Version
      • From: Finlay Dobbie <email@hidden>
  • Prev by Date: Re: deactivating an NSScrollView
  • Next by Date: Rotating an NSImage
  • Previous by thread: Re: NSView, scrolling colorWithPatternImage
  • Next by thread: Re: Getting Current System Version
  • Index(es):
    • Date
    • Thread