Re: Building for 10.12
Re: Building for 10.12
- Subject: Re: Building for 10.12
- From: Rob Petrovec via Cocoa-dev <email@hidden>
- Date: Sun, 20 Mar 2022 11:00:23 -0600
> On Mar 20, 2022, at 9:09 AM, Gabriel Zachmann <email@hidden> wrote:
>
> I have now the crash report.
>
> Apparently, this caused it:
>
> Symbol not found: _AVAudioSessionInterruptionNotification
>
> Yes, I am using that function, and yes, it seems to be available only on
> macOS 11 and higher.
>
> My question now is: why did Xcode not warn me about that function, even
> though the deployment target was set to 10.12 ?
The deployment target not a compiler setting. It is more of a runtime
thing. So if you set the deployment target to 13.0 it will not launch on macOS
12, for example. The SDK is what determines what API are (not) available. So
if you were building against the 10.12 SDK you would have gotten a compiler
error.
> How can I prevent things like that happening in the future?
Use the correct SDK for the OS builds you want to support. There are
macros you can use to block off areas of code that require specific OS
versions. For example:
#include <Availability.h>
#if defined(__MAC_10_12) && __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_10_12
// code that requires the 10.12 or later SDK
#endif
—Rob
_______________________________________________
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