• 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: operatingSystemVersionString replacement
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: operatingSystemVersionString replacement


  • Subject: Re: operatingSystemVersionString replacement
  • From: Sean McBride <email@hidden>
  • Date: Fri, 25 Oct 2013 11:53:01 -0400
  • Organization: Rogue Research Inc.

On Fri, 25 Oct 2013 06:02:23 -0700, Gary L. Wade said:

>Not to say using the OS version number is right in your case, but when I
>need a parseable OS version number without relying upon Gestalt, I get the
>ProductVersion key from /System/Library/CoreServices/SystemVersion.plist
>and parse that into an NSIndexPath, which works great with encapsulating
>10.8.5, 10.9, 10.7.5.12, etc.

I agree with others that NSAppKitVersionNumber and friends are usually preferable, but sometimes it is useful/required to get the actual numbers "10", "8", and "5" in a parseable/non-localized way.  Parsing uname results is fragile.  operatingSystemVersionString is localized.  Assuming /System/Library/CoreServices/SystemVersion.plist will always be at that path is fragile.  Can you even read it when sandboxed?

Gestalt(), despite being deprecated, is the safest way:

	Gestalt (gestaltSystemVersionMajor, &major);
 Gestalt (gestaltSystemVersionMinor, &minor);
	Gestalt (gestaltSystemVersionBugFix, &fix);

IMHO, it was deprecated prematurely, without a replacement for uses like this.

Cheers,

--
____________________________________________________________
Sean McBride, B. Eng                 email@hidden
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada



_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: operatingSystemVersionString replacement
      • From: August Mueller <email@hidden>
    • Re: operatingSystemVersionString replacement
      • From: "Gary L. Wade" <email@hidden>
References: 
 >operatingSystemVersionString replacement (From: "Gerriet M. Denkmann" <email@hidden>)
 >Re: operatingSystemVersionString replacement (From: "Gary L. Wade" <email@hidden>)

  • Prev by Date: Re: operatingSystemVersionString replacement
  • Next by Date: Autolayout wrt Cassowary
  • Previous by thread: Re: operatingSystemVersionString replacement
  • Next by thread: Re: operatingSystemVersionString replacement
  • Index(es):
    • Date
    • Thread