I have a large macOS project that is getting close to release, and now the work of compatibility testing on older operating systems begins.
We would like to support OS X 10.9 through macOS 10.13. Right away, all of the apps crash on 10.9 because—somewhere—there's an inadvertent reference to a symbol or function call that was added in a later OS.
So....
It would seem like there would a be a tool in Xcode that would help identify symbols/classes/methods/functions that might not be available in the deplyment OS. But I can't seem to find anyway of finding said symbols.
My next thought was to simply change the Base SDK to 10.9, compile the projects, and see what errors I got. I could then verify that every "undefined" reference was property protected by code that used an alternate method on an older OS. But it now seems that Xcode 9 only ships with macOS 10.13 SDK and there no longer a place to downloading earlier SDKs. (I swear the "components" section in the settings used to have an SDK tab where you could get them.)
I can't be the first developer to run into this problem.
Any suggestion?
Found it!
Thanks Quinn, that set me on the right path.
So Xcode 9 includes a new CLANG_WARN_UNGUARDED_AVAILABILITY build setting. If set to YES it causes the -Wunguarded-availability-new switch to be passed to the compiler.
However, this setting only checks for the use of post-10.13 APIs. If your deployment is set to 10.9 and you use a 10.11 feature, you still don't get a warning. This is the default setting, and is why I wasn't gettting any warnings.
To get a warning about the use of any post-deployment API feature you have to set CLANG_WARN_UNGUARDED_AVAILABILITY=YES_AGGRESSIVE (or "Yes (All Versions)" as it appears in the Xcode build settings). That setting invokes the more thorough -Wunguarded-availability compiler switch.
Now you'll get a warning about any (unguarded) API usage.
I now have about a thousand warnings to go reivew, but I'll sleep better at night.