What is the "gestalt" value for Yosemite?

What is the “gestalt” value for Yosemite?

Lennox

using the example from Xojo I get

Max OS X v10.10.4

but
This item has been DEPRECATED.
There is no replacement for this item.

  Dim major, minor, bug As Integer
  
  If System.Gestalt("sys1", major) Then
    If System.Gestalt("sys2", minor) Then
      If System.Gestalt("sys3", bug) Then
        MsgBox "Max OS X v" + Str(major) + "." + Str(minor) + "." + Str(bug)
      End If
    End If
  End If

I use

  Dim xml As New XmlDocument
  dim ProductVersion as String
  dim f as FolderItem = SpecialFolder.System.Child _
  ("Library").Child("CoreServices").Child("SystemVersion.plist")
  if f <> nil and f.Exists then
    xml.LoadXml(f)
    dim node, subnode as XmlNode
    dim i, j as integer
    dim s, v, out as String
    for i = 0 to xml.DocumentElement.ChildCount-1
      node= xml.DocumentElement.Child(i)
      for j = 0 to node.ChildCount-1
        subnode = node.Child(j)
        s = subnode.FirstChild.Value
        if s = "ProductVersion" then
          ProductVersion = xml.DocumentElement.FirstChild.Child(j + 1).Child(0).Value
        end if
      next
    next
    MsgBox ProductVersion
  end if

Please see this thread where we covered the alternative functions and posted the code.
https://forum.xojo.com/16320-recognize-version-of-os-x/p2#p134864

It has fallback code included so it can be used for 10.9.x and 10.11.

It’s worth mentioning that while appKitVersionNumber is the #1 recommend method from Apple to figure which version of the OS you’re running, that it’s currently broken with El Capitan. So you do need to use the functions included for accessing NSProcessInfo.operatingSystemVersion on El Capitan.

If you’re using this to control what features are available, the Apple recommend way is to test for the OS X classes and their functions (although with Yosemite DPs some classes reported they didn’t have said functions when they did). It can also report that the class has a function, but the function is only implemented on 64-Bit so it doesn’t actually work!

It seems to me that getting the OS version SHOULD be built into the framework in a RAD product. On OSX we HAD gestalt… but on Windows I had to rely on the WFS methods… but will they work in 64 bit?

I understand Linux may not have a consistent way to do it across distributions, and that what you get back for OS X and Windows are not in the same format, nor have the same meaning but that is something that is seems to me Xojo should be helping us with!

  • Karen

Thanks.
Lennox

I’m guessing the NSProcessInfo will also work on iOS too, but don’t do any iOS at the moment.

@Karen Atkocius Yeah that would probably be useful. Log it into Feedback, in the mean time if someone with more Windows & linux experience could fill in the other parts to the code I provided, we can have a community effort much quicker.

using MBS Plugin you can use SystemInformationMBS module and/or NSProcessInfoMBS class.

Gestalt will only return 10.9.

For Mac OS X a shell to

sw_vers

gives me

ProductName: Mac OS X ProductVersion: 10.10.3 BuildVersion: 14D131

For Windows, the equivalent is

ver

I prefer not to relay on output of command line tools.
OS may not include them in future or output format may change, so parsing can be a challenge.

We were told at XDC that WFS is essentially dead for 64 bit. Everything in it will have to be rewritten. WFS was created before Structs came into the language so it uses MemoryBlocks to accomplish the same thing. 64 bit messes with them in a big way.

[quote=196165:@Christian Schmitz]I prefer not to relay on output of command line tools.
OS may not include them in future or output format may change, so parsing can be a challenge.[/quote]

Deprecation of line commands seems a lot less probable than API ones :wink:

I wouldn’t be so sure… I can’t recall exactly what it was I was using (10 years), but Apple changed the parameters and I didn’t realize until people started complaining that my app doesn’t work and is ■■■■.

Generally with APIs, Apple do make on the App Differences document when it’s changed, however with Yosemite that also changed when they made some APIs 64-Bit only (deprecating the 32-Bit version without documentation it).

All you can do, is to do a clean install of any beta and throughly test your software, for every friking beta and then the GM.

[quote=196372:@Sam Rowlands]I wouldn’t be so sure… I can’t recall exactly what it was I was using (10 years), but Apple changed the parameters and I didn’t realize until people started complaining that my app doesn’t work and is shit.

Generally with APIs, Apple do make on the App Differences document when it’s changed, however with Yosemite that also changed when they made some APIs 64-Bit only (deprecating the 32-Bit version without documentation it).

All you can do, is to do a clean install of any beta and throughly test your software, for every friking beta and then the GM.[/quote]

If there is one certainty, it is that nothing is ever sure with Apple. They do change things all the time and with little notice.

Truly, though, in many years I was lucky enough to never encounter any issue with the numerous shell calls I use in my apps, whereas as you do report from time to time, the enchanted world of API’s looks like California’s jurisprudence. My post was basically a response to the thread question, which I interpreted as “is there a way to detect Yosemite”. Since Gestalt is deprecated, and apart from API’s in their diverse implementations by declare or MBS plugins (wink), command line is a rather simple and reasonably stable option.

Given the one new OS version a year policy, though, I am starting to grow into considering the fast deprecations of apps as an opportunity for renewal sales rather than an impediment. I know the run-in you had with Apple reviewers about upgrades but am working on a new idea. Apple does not want us to have paid upgrade (that too may change one day), but what if an app called home to simply check if a new version is available and simply show the user through the default browser to a web site where it is described ? This is not in app sale, it is information…

One thing is for sure, I had enough of stupid malevolent customer reviews that pollute the app and give no chance to ever fix the problem. Like the blank canvas issue reported by Torben Vikov in https://forum.xojo.com/23561-are-there-known-issues-with-the-canvas-on-osx-10-10-3/0 where a stupid user screams in public instead of getting in touch with the developer.

The whole review büllshit is probably on its way out, just as pure anonymity on Facebook. Trolling is getting out of control throughout the Internet, with even Asian companies now specializing in fake reviews. There are now copycat mongers who seem to set aside a budget especially to dish the original, and damage it as much as they can. I am not talking especially about the MAS, it is a very real problem throughout, would that be Amazon, restaurant guides or anonymous forums. Social networks are starting to grow defenses against that plague, as Web 2.00 soon 3.00 cannot go on with such a mess around their business. Heck, if even Reddit starts working on it, the problem must really get nasty.

At which point does one stop doing business because of unfair competitive practices ?

The more I go and the more I loathe an app store in decline with political commissaries of the party who do everything to prevent us from innovating, whilst Apple itself plays “do as I say, not as I do”.

For now on, when one of my apps has been desecrated with graffitis (read stupid reviews), the new version will start on a blank page. Too bad for updates, since Apple does not have the decency to allow a normal relationship with users.

I am not ready to quit the MAS entirely, but I do not see why I should continue being so stupidly nice. Apple is one of the most ruthless companies ; I don’t see why I should remain so naive.

This is exactly how I’ve started to think about it also, trouble is trying to get my schedule to align with theirs is going to take some work. But to always make sure that when the next OS X is released, you have a ‘New’ version ready.[quote=196380:@Michel Bujardet]One thing is for sure, I had enough of stupid malevolent customer reviews that pollute the app and give no chance to ever fix the problem. Like the blank canvas issue reported by Torben Vikov in https://forum.xojo.com/23561-are-there-known-issues-with-the-canvas-on-osx-10-10-3/0 where a stupid user screams in public instead of getting in touch with the developer.[/quote]
The biggest irony I have with customer reviews, is the better the reviews, the least sales I make… What I mean is that my products that have the best reviews, are not mainstream products and therefore on the App Store, don’t sell.

Agreed, I see so many competitors who don’t follow the App Store Review Guidelines and get promoted by Apple, am I a sore loser yes ■■■■■■■ hell, who isn’t!

So this year, we’ve started to do what the competition does (which is against the ASRG), when we get rejected, we’ll simply point the review team to all the other applications that do this and are allowed on the App Store.

I’ve gone from being one of the biggest Apple advocates on the planet, to beginning to loathe Apple, in only a couple of years.