I am running an application built using C++ on new macOS 12 Monterey beta. The application is built using macOS SDK 10.9 which is quite old.
The Problem:
There is a code to fetch the platform version, where i parse the content of System/Library/CoreServices/SystemVersion.plist
file using Core-Foundation API. Instead of returning macOS version as 12.0 the application is reading it as 10.16. There is no flaw in code since same code has been in use for identifying many older macOS versions.
Probable Cause: Something has changed during macOS 11.0 bigSur release wherein there is another file name SystemVersionCompat.plist that is in same location as SystemVersion.plist. My application is reading the former instead of later plist and on some web search got to know its because of use of older SDK.
Content of System/Library/CoreServices/SystemVersion.plist
:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ProductBuildVersion</key>
<string>21A5304g</string>
<key>ProductCopyright</key>
<string>1983-2021 Apple Inc.</string>
<key>ProductName</key>
<string>macOS</string>
<key>ProductUserVisibleVersion</key>
<string>12.0</string>
<key>ProductVersion</key>
<string>12.0</string>
<key>iOSSupportVersion</key>
<string>15.0</string>
</dict>
</plist>
Content of System/Library/CoreServices/SystemVersionCompat.plist
:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ProductBuildVersion</key>
<string>21A5304g</string>
<key>ProductCopyright</key>
<string>1983-2021 Apple Inc.</string>
<key>ProductName</key>
<string>Mac OS X</string>
<key>ProductUserVisibleVersion</key>
<string>10.16</string>
<key>ProductVersion</key>
<string>10.16</string>
<key>iOSSupportVersion</key>
<string>15.0</string>
</dict>
</plist>
Is there any other convenient way to get the platform version without updating SDK ?