Skip to content

[RUM-18034] fix: tvOS build issue - #1367

Merged
marco-saia-datadog merged 2 commits into
developfrom
marcosaia/rum-18034/ios-tv-os-build-issue
Aug 13, 2026
Merged

[RUM-18034] fix: tvOS build issue#1367
marco-saia-datadog merged 2 commits into
developfrom
marcosaia/rum-18034/ios-tv-os-build-issue

Conversation

@marco-saia-datadog

Copy link
Copy Markdown
Member

What does this PR do?

Fixes the tvOS build (ref #1361) by guarding the remaining iOS-only DatadogWebViewTracking references: an import in DdSdkImplementation.swift and an unguarded consumeWebviewEvent bridge method in DdSdk.mm. Also adds a unit test that scans the native iOS sources for unguarded references to these symbols, to catch this kind of regression before it ships.

Additional Notes

Original PR by @MaeIg, thank you for your contribution!

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)
  • If this PR is auto-generated, please make sure also to manually update the code related to the change

Copilot AI lite review requested due to automatic review settings August 12, 2026 09:56
@marco-saia-datadog
marco-saia-datadog requested a review from a team as a code owner August 12, 2026 09:56
@marco-saia-datadog marco-saia-datadog changed the title fix: tvOS build issue [RUM-18034] fix: tvOS build issue Aug 12, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes the tvOS build by ensuring iOS-only WebView tracking symbols and the consumeWebviewEvent React Native bridge entrypoint are not compiled on tvOS, and adds a unit test to prevent future unguarded references in iOS native sources.

Changes:

  • Remove an unguarded DatadogWebViewTracking import from DdSdkImplementation.swift (keep iOS-only usage behind #if os(iOS)).
  • Guard the consumeWebviewEvent React Native bridge method in DdSdk.mm with #if TARGET_OS_IOS.
  • Add TvOSCompatibilityTests to statically scan ios/Sources for unguarded references to iOS-only symbols.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
packages/core/ios/Tests/TvOSCompatibilityTests.swift Adds a static source-scan test to detect unguarded iOS-only symbol usage that would break tvOS builds.
packages/core/ios/Sources/DdSdkImplementation.swift Removes an unguarded iOS-only framework import to avoid tvOS compilation failures.
packages/core/ios/Sources/DdSdk.mm Wraps the WebView event bridge export in an iOS-only compile-time guard.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/core/ios/Tests/TvOSCompatibilityTests.swift Outdated
Comment thread packages/core/ios/Tests/TvOSCompatibilityTests.swift
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings August 12, 2026 10:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

Suppressed comments (2)

packages/core/ios/Tests/TvOSCompatibilityTests.swift:82

  • XCTFail is being reported with file: #filePath (this test file) but line: UInt(lineNumber) from the scanned source file. This mismatch can make the failure location misleading (or point to a non-existent line in the test file). The message already includes the scanned file/line, so let XCTest report the failure at the call site.
                XCTFail(
                    "\(url.lastPathComponent):\(lineNumber) references iOS-only symbol " +
                        "'\(symbol)' without a '\(guardPattern)' guard. This will break the tvOS " +
                        "build: wrap this reference in the appropriate platform guard.",
                    file: #filePath,
                    line: UInt(lineNumber)
                )

packages/core/ios/Tests/TvOSCompatibilityTests.swift:62

  • The #else handling in this guard scanner flips matches (matches: !top.matches). This makes any #else branch under an unrelated #if/#ifdef (e.g. #ifdef RCT_NEW_ARCH_ENABLED in Sources/DdSdk.mm) look "guarded" and therefore skip symbol checks, which can hide unguarded iOS-only references.
            if line.hasPrefix("#else") {
                if let top = stack.last {
                    stack[stack.count - 1] = (matches: !top.matches, parentGuarded: top.parentGuarded)
                }
                continue

@marco-saia-datadog
marco-saia-datadog merged commit dcdce40 into develop Aug 13, 2026
12 checks passed
@marco-saia-datadog
marco-saia-datadog deleted the marcosaia/rum-18034/ios-tv-os-build-issue branch August 13, 2026 15:04
@sbarrio sbarrio mentioned this pull request Aug 14, 2026
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants