From 4f43bb5645457079b18ef39aef8816a610ff56d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C5=82az=CC=87ej=20Pankowski?= <86720177+pblazej@users.noreply.github.com> Date: Wed, 10 Jun 2026 13:09:42 +0200 Subject: [PATCH] Don't reference withAUAudioUnit (breaks newer-compiler / older-SDK builds) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Swift main-snapshot build (newer compiler + current stable macOS SDK) fails with "cannot find 'withAUAudioUnit' in scope": `#if compiler(>=6.4)` selects the `withAUAudioUnit` branch, but that symbol only exists in the macOS 27 SDK, and the snapshot toolchain pairs a >=6.4 compiler with the macOS 26 SDK. There's no reliable compile-time SDK / API-presence check in Swift (`canImport(_:_version:)` doesn't distinguish the SDKs), so drop `withAUAudioUnit` and reach `auAudioUnit` — which exists on every SDK — under `if #available(macOS 13.0)`, falling back to `LKObjCHelpers` below macOS 13. `#if compiler(>=6.4)` is kept only so older toolchains use the property directly (no ObjC shim) down to macOS 10.13. Co-Authored-By: Claude Opus 4.8 (1M context) --- Sources/LiveKit/Extensions/AVAudioNode.swift | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/Sources/LiveKit/Extensions/AVAudioNode.swift b/Sources/LiveKit/Extensions/AVAudioNode.swift index b3b35d3d6..f42e0f09b 100644 --- a/Sources/LiveKit/Extensions/AVAudioNode.swift +++ b/Sources/LiveKit/Extensions/AVAudioNode.swift @@ -23,16 +23,13 @@ internal import LKObjCHelpers extension AVAudioNode { /// The underlying audio unit's `maximumFramesToRender`. /// - /// The Xcode 27 SDK restricts `auAudioUnit` to macOS 13.0 and deprecates it in favor of - /// `withAUAudioUnit`, so this prefers `withAUAudioUnit` on OS 27+, uses the `auAudioUnit` property - /// on macOS 13–26, and falls back to ``LKObjCHelpers`` (original ObjC availability, macOS 10.13) - /// below macOS 13. See #1035. + /// The macOS 27 SDK restricts `auAudioUnit` to macOS 13.0; below that it's reached through + /// ``LKObjCHelpers``, which keeps the property's original Objective-C availability (macOS 10.13). + /// See #1035. var maximumFramesToRender: AUAudioFrameCount { get { #if compiler(>=6.4) - if #available(macOS 27.0, iOS 27.0, tvOS 27.0, visionOS 27.0, *) { - return withAUAudioUnit { $0.maximumFramesToRender } - } else if #available(macOS 13.0, *) { + if #available(macOS 13.0, *) { return auAudioUnit.maximumFramesToRender } else { return LKObjCHelpers.maximumFramesToRender(for: self) @@ -43,9 +40,7 @@ extension AVAudioNode { } set { #if compiler(>=6.4) - if #available(macOS 27.0, iOS 27.0, tvOS 27.0, visionOS 27.0, *) { - withAUAudioUnit { $0.maximumFramesToRender = newValue } - } else if #available(macOS 13.0, *) { + if #available(macOS 13.0, *) { auAudioUnit.maximumFramesToRender = newValue } else { LKObjCHelpers.setMaximumFramesToRender(newValue, for: self)