-
Notifications
You must be signed in to change notification settings - Fork 189
Fix Xcode 27 beta build errors #1038
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
598ebb1
Fix Xcode 27 beta build errors
pblazej 162799d
Prefer withAUAudioUnit for maximumFramesToRender where available
pblazej d0afa8b
Silence pre-existing build warnings surfaced on Xcode 27 / newer SDKs
pblazej bf7db9a
Use auAudioUnit directly on macOS 13–26 in maximumFramesToRender
pblazej File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| patch type="fixed" "Fixed Xcode 27 beta build errors" |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,32 @@ | ||
| #import <Foundation/Foundation.h> | ||
| #import <ReplayKit/ReplayKit.h> | ||
| #import <AVFAudio/AVFAudio.h> | ||
| #import <AudioToolbox/AudioToolbox.h> | ||
|
|
||
| #if TARGET_OS_OSX | ||
| #import <ScreenCaptureKit/ScreenCaptureKit.h> | ||
| #endif | ||
|
|
||
| @interface LKObjCHelpers : NSObject | ||
|
|
||
| #pragma clang diagnostic push | ||
| // RPBroadcastSampleHandler is deprecated in the iOS 27 SDK; suppress so the module still builds (#1037). | ||
| #pragma clang diagnostic ignored "-Wdeprecated-declarations" | ||
| + (void)finishBroadcastWithoutError:(RPBroadcastSampleHandler *)handler API_AVAILABLE(ios(10.0), macCatalyst(13.1), macos(11.0), tvos(10.0)); | ||
| #pragma clang diagnostic pop | ||
|
|
||
| + (BOOL)catchException:(void(^)(void))tryBlock error:(__autoreleasing NSError **)error; | ||
|
|
||
| // MARK: - Xcode 27 availability workarounds | ||
| // The macOS 27 SDK bumped these APIs past the OS versions they actually ship in (only the Swift | ||
| // importer enforces it). Reaching them from ObjC keeps full behavior on every SDK/OS version (#1035). | ||
|
|
||
| + (AUAudioFrameCount)maximumFramesToRenderForNode:(AVAudioNode *)node; | ||
|
|
||
| + (void)setMaximumFramesToRender:(AUAudioFrameCount)maximumFramesToRender forNode:(AVAudioNode *)node; | ||
|
|
||
| #if TARGET_OS_OSX | ||
| + (void)setWidth:(size_t)width height:(size_t)height onConfiguration:(SCStreamConfiguration *)configuration API_AVAILABLE(macos(12.3)); | ||
| #endif | ||
|
|
||
| @end |
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| /* | ||
| * Copyright 2026 LiveKit | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| import AVFAudio | ||
|
|
||
| #if compiler(>=6.4) && !COCOAPODS | ||
| internal import LKObjCHelpers | ||
| #endif | ||
|
|
||
| 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. | ||
| 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, *) { | ||
| return auAudioUnit.maximumFramesToRender | ||
| } else { | ||
| return LKObjCHelpers.maximumFramesToRender(for: self) | ||
| } | ||
| #else | ||
| return auAudioUnit.maximumFramesToRender | ||
| #endif | ||
| } | ||
| 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, *) { | ||
| auAudioUnit.maximumFramesToRender = newValue | ||
| } else { | ||
| LKObjCHelpers.setMaximumFramesToRender(newValue, for: self) | ||
| } | ||
| #else | ||
| auAudioUnit.maximumFramesToRender = newValue | ||
| #endif | ||
| } | ||
| } | ||
| } | ||
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a little overengineered vs e.g.
which would surface the deprecation on 27.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May change in the upcoming betas tho...