• 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
PSA: floor(NSFoundationVersionNumber) doesn't work with Yosemite or later
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

PSA: floor(NSFoundationVersionNumber) doesn't work with Yosemite or later


  • Subject: PSA: floor(NSFoundationVersionNumber) doesn't work with Yosemite or later
  • From: Charles Srstka <email@hidden>
  • Date: Fri, 10 Jul 2015 14:01:49 -0500

Just thought I’d like to warn everyone about something:

In the past, the NSFoundationVersionNumber constants for the same major OS version always used to have the same integer component. For example, the constants for 10.8, 10.8.1, 10.8.2, 10.8.3, and 10.8.4 are 945.00, 945.00, 945.11, 945.16, and 945.18 respectively. As a result, we’ve often been using floor(NSFoundationVersionNumber) to determine the major OS version being used for the purpose of branching on features that may not be available in older OS versions.

This seems to be no longer the case for Yosemite. The NSFoundationVersionNumber constants for Yosemite are:

10.10: 1151.16
10.10.1: 1151.16
10.10.2: 1152.14
10.10.3: 1153.20

The NSAppKitVersionNumber constants are doing the same thing:

10.10: 1343
10.10.2: 1344
10.10.3: 1347

What this means is that if you try to use an El Capitan-only feature and put it in a block that starts with a check on floor(NSFoundationVersionNumber) or floor(NSAppKitVersionNumber) to make sure it’s larger than the value for 10.10.0, your code in that block will get called on all versions of 10.10.x greater than 10.10.1. Once Yosemite stops being updated, we can of course use the constant for the last version that’s released, but since we still can’t say with 100% certainty that there won’t be a 10.10.5, we can’t really rely on this.

The upshot of this is that for checking if anything is later than Yosemite, it’s probably safer to use -[NSProcessInfo operatingSystemVersion] instead of NSFoundationVersionNumber.

Just thought I’d let everyone know.

Charles


_______________________________________________

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: PSA: floor(NSFoundationVersionNumber) doesn't work with Yosemite or later
      • From: Ben Kennedy <email@hidden>
  • Prev by Date: Re: How to resize accessory view to match Open panel
  • Next by Date: Re: Swift 2 throws from init()
  • Previous by thread: Re: protocol extension with SequenceType
  • Next by thread: Re: PSA: floor(NSFoundationVersionNumber) doesn't work with Yosemite or later
  • Index(es):
    • Date
    • Thread