Fix Xcode 27 beta build errors#1038
Merged
Merged
Conversation
The macOS 27 / iOS 27 SDKs re-annotate several APIs with higher availability than the OS versions they actually ship in, which the Swift importer enforces as hard errors: - AVAudioNode.auAudioUnit: the Swift overlay is now introduced macOS 13.0 (the Objective-C property is still macos(10.13)) - SCStreamConfiguration.width/height: bumped from macos(12.3) to macos(13.0) - RPBroadcastSampleHandler: deprecated in iOS 27, which breaks the LKObjCHelpers precompiled module under -Werror Route AVAudioNode.maximumFramesToRender through LKObjCHelpers via an extension, where the original ObjC availability still applies, so it works on every SDK/OS version with no version check and no behavior change. Screen capture sets width/height through the same helper on Xcode 27 (#if compiler(>=6.4)) and directly on older toolchains. Also restores the macOS maximumFramesToRender matching that #1034 had to drop. Closes #1035 Closes #1037 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
c6124cb to
598ebb1
Compare
On the Xcode 27 SDK, use the non-deprecated withAUAudioUnit (macOS/iOS/tvOS/visionOS 27+) and fall back to the LKObjCHelpers ObjC workaround only on earlier OSes. Toolchains before Swift 6.4 keep the direct auAudioUnit property. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
pblazej
commented
Jun 10, 2026
| /// which keeps the property's original Objective-C availability (macOS 10.13). See #1035. | ||
| var maximumFramesToRender: AUAudioFrameCount { | ||
| get { | ||
| #if compiler(>=6.4) |
Contributor
Author
There was a problem hiding this comment.
It's a little overengineered vs e.g.
if #available(macOS 13.0, *) {
return auAudioUnit.maximumFramesToRender
}
return LKObjCHelpers.maximumFramesToRender(for: self)which would surface the deprecation on 27.
Contributor
Author
There was a problem hiding this comment.
May change in the upcoming betas tho...
hiroshihorie
approved these changes
Jun 10, 2026
- BroadcastUploader: bare `Task { try await … }` → `Task.discarding`
(#NoUseUnstructuredThrowingTask is active under Swift 6.4)
- BroadcastAudioCodec: qualify the retroactive `AudioStreamBasicDescription`
`Codable` conformance as `Swift.Codable`, matching the `Sendable.swift`
convention for suppressing the imported-conformance warning
- Utils.modelIdentifier: `kIOMasterPortDefault` → `kIOMainPortDefault`,
guarded with the NULL default port (0) before macOS 12
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
669593d to
d0afa8b
Compare
Narrows the LKObjCHelpers fallback to macOS < 13: withAUAudioUnit on OS 27+, the auAudioUnit property on macOS 13–26 (available and not yet deprecated there), and the ObjC shim only below macOS 13. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
pblazej
added a commit
that referenced
this pull request
Jun 10, 2026
## Summary Follow-up to #1038. The nightly **Swift Snapshot Build** (`.github/workflows/swift-snapshot.yaml`) fails on `main` after #1038: ``` Sources/LiveKit/Extensions/AVAudioNode.swift:34:24: error: cannot find 'withAUAudioUnit' in scope ``` ## Root cause That workflow runs `swift build` with the **main-snapshot** compiler (so `#if compiler(>=6.4)` is true) but against the runner's **current stable SDK** (macOS 26 — `latest` Xcode, since 27 is still beta). `withAUAudioUnit` only exists in the **macOS 27 SDK**, so the `compiler(>=6.4)` branch compiles the symbol in, but the SDK doesn't have it. The deeper issue: `#if compiler(>=6.4)` is a *compiler* check used as an *SDK* proxy. That holds for shipping Xcode (compiler and SDK ship together) but not for the snapshot toolchain (new compiler + stable SDK). There's no reliable compile-time SDK/API-presence check in Swift — `canImport(AVFAudio, _version:)` reports the same version in both SDKs, and keying off a new-in-27 framework would be fragile. ## Fix Drop `withAUAudioUnit` and reach `auAudioUnit` — which exists on **every** SDK (only its Swift availability annotation differs) — under `if #available(macOS 13.0)`, falling back to `LKObjCHelpers` below macOS 13. `#if compiler(>=6.4)` is kept so older toolchains (Xcode 16.4 / 26.5) use the property directly with no ObjC shim down to macOS 10.13. This compiles on every compiler/SDK combination, including the snapshot's newer-compiler + macOS 26 SDK. ## Testing - `swift build --build-system native` with the Xcode 27 compiler **+ macОS 26 SDK** (reproduces the snapshot combo): **Build complete** ✅ (was: `cannot find 'withAUAudioUnit'`). - Xcode 27 (macOS/iOS) and Xcode 26.5 (macOS) builds: ✅ - swiftformat clean. No user-facing behavior change (the `auAudioUnit` access is functionally identical), so no changeset. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the Xcode 27 beta (macOS 27 / iOS 27 SDK) build failures reported in #1035 and #1037. Behavior is preserved on every OS and toolchain — there is no macOS 12.x regression.
Root cause
These are SDK-side annotation changes that only the Swift importer enforces as hard errors — the underlying APIs still exist on the OS versions they always shipped in:
AVAudioNode.auAudioUnit: gainedNS_REFINED_FOR_SWIFT; its new Swift overlay isintroduced: macOS 13.0, deprecated: 27.0(in favor ofwithAUAudioUnit). The Objective-C property is stillmacos(10.13).SCStreamConfiguration.width/height: re-annotated from the class-inheritedmacos(12.3)to an explicitmacos(13.0)when Apple extended ScreenCaptureKit to iOS/tvOS 27.RPBroadcastSampleHandler: deprecated in the iOS 27 SDK (ios(10.0, 27.0)). Xcode 27 builds theLKObjCHelpers.pcmwith-clang-target …ios27.0, so the deprecation fires and-Werrorfails the module. (Requires that clang-target + "treat warnings as errors", which is why it doesn't reproduce on a default build.)Changes
auAudioUnit): newAVAudioNode.maximumFramesToRenderextension that centralizes access; call sites (PlayerNodePool,SoundPlayer,MixerEngineObserver) just usenode.maximumFramesToRender. It resolves per toolchain/OS:compiler < 6.4): theauAudioUnitproperty directly — unchanged.withAUAudioUnit { … }, the non-deprecated replacement Apple points to.auAudioUnitproperty (available and not yet deprecated there).LKObjCHelpers, where the original ObjC availability (macos(10.13)) still applies — so full behavior is preserved with no regression.width/height):#if compiler(>=6.4)→LKObjCHelpers.setWidth(…)(Xcode 27, preserves full capture resolution on macOS 12.x);#else→ nativeconfiguration.width/height(Xcode 26 stays idiomatic).-Wdeprecated-declarationspragma around thefinishBroadcastWithoutError:declaration so the precompiled module emits.maximumFramesToRendermatching runs on macOS again via the extension, so the#if os(iOS) || os(visionOS) || os(tvOS)once more wraps only the iOS audio-session logging.BroadcastUploader's bareTask { try await … }→Task.discarding; the retroactiveAudioStreamBasicDescription: Codableconformance qualified asSwift.Codable(matching theSendable.swiftconvention); andkIOMasterPortDefault→ guardedkIOMainPortDefaultinUtils. The build is now warning-free apart from the unrelatedE2EEOptionsdeprecation.Note:
#if compiler(>=6.4)(toolchain version), not#if swift(>=6.4)(language version) — the latter is false under CocoaPods (swift_versions ["5.9"]) on Xcode 27 and would take the wrong path.Testing
Built locally against Xcode 27 beta (27A5194q, Swift 6.4) and Xcode 26.5 (Swift 6.3.2):
Closes #1035
Closes #1037
🤖 Generated with Claude Code