Skip to content

fix(ios): Stop importing SentryScope.h, removed in sentry-cocoa - #7079

Draft
sentry-junior[bot] wants to merge 1 commit into
mainfrom
fix/ios-scope-swift-header
Draft

sentry-junior[bot] wants to merge 1 commit into
mainfrom
fix/ios-scope-swift-header

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

📢 Type of change

  • Bugfix
  • Refactoring

📜 Description

  • Drop #import <Sentry/SentryScope.h> from RNSentryBreadcrumb.h. The header never used it.
  • RNSentry.mm no longer gets the SentryScope interface transitively, and as Objective-C++ it can't @import Sentry, so it only sees @class SentryScope. Its scope mutations (setUser, addBreadcrumb, clearBreadcrumbs, setExtra, setContext/removeContext, setTag, setAttribute(s), removeAttribute) now go through new SentrySDKWrapper class methods. SentrySDKWrapper.m imports the Sentry module and makes the same configureScope calls as before. Behavior doesn't change.
  • fetchNativeLogAttributes and fetchNativeDeviceContexts still call configureScope directly. They only pass the scope pointer to RNSentryInternalWrapper, so a forward declaration is enough.

The selectors are the same in the ObjC SentryScope.h (9.35.0, currently pinned) and in the Swift Scope on sentry-cocoa main, so this works with both.

💡 Motivation and Context

getsentry/sentry-cocoa#9552 converted SentryScope to Swift and deleted Sources/Sentry/Public/SentryScope.h. Since then, the sentry-cocoa nightly "Hybrid SDKs / Test sentry-react-native" job can't build the RNSentry module:

RNSentry-umbrella.h:17 -> RNSentryBreadcrumb.h:3:9
'Sentry/SentryScope.h' file not found
fatal error: could not build module 'RNSentry'

Failing run: https://github.com/getsentry/sentry-cocoa/actions/runs/44853776193

Without this change, the iOS build here breaks with the first sentry-cocoa release that includes #9552.

📝 Checklist

  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • No breaking changes.

🔮 Next steps

There's no changelog entry because nothing changes for users. Open question: should it go under ### Internal?

via itay.

--

View Session [Sentry]

sentry-cocoa converted SentryScope to Swift (getsentry/sentry-cocoa#9552)
and deleted Sources/Sentry/Public/SentryScope.h. RNSentryBreadcrumb.h, a
public header in the RNSentry umbrella, still imported it, so the module
no longer builds against sentry-cocoa main.

Drop the unused import. RNSentry.mm then only sees a forward declaration
of SentryScope and cannot message it, so route its scope mutations
through SentrySDKWrapper, which imports the Sentry module.

Co-Authored-By: Itay Brenner <itay.brenner@sentry.io>
@github-actions

Copy link
Copy Markdown
Contributor

Semver Impact of This PR

⚪ None (no version bump detected)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


  • fix(ios): Stop importing SentryScope.h, removed in sentry-cocoa by itaybre with sentry-junior in #7079
  • chore(sample): Remove unused Detox setup from the React Native sample by antonis and claude in #7072
  • ci(ios): Build TestFlight sample with Xcode 27 by philprime with sentry-junior in #7065
  • perf(android): Create SDK view managers on demand by alwx in #7049
  • fix(core): Remove web Replay and Feedback from native bundles by default by huextrat, claude and antonis in #7062
  • fix(core): Define UnsafeObject locally instead of deep importing it by alwx in #7061
  • chore(deps): update Android SDK to v8.65.0 by github-actions in #7058

🤖 This preview updates automatically when you update the PR.

@github-actions

Copy link
Copy Markdown
Contributor
Fails
🚫 Pull request is not ready for merge, please add the "ready-to-merge" label to the pull request
🚫 Please consider adding a changelog entry for the next release.

Instructions and example for changelog

Please add an entry to CHANGELOG.md to the "Unreleased" section. Make sure the entry includes this PR's number.

Example:

## Unreleased

### Fixes

- Stop importing SentryScope.h, removed in sentry-cocoa ([#7079](https://github.com/getsentry/sentry-react-native/pull/7079))

If none of the above apply, you can opt out of this check by adding #skip-changelog to the PR description or adding a skip-changelog label.

Generated by 🚫 dangerJS against 2d0f376

@itaybre

itaybre commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

@antonis sharing this since you will probably need this change when bumping the version.

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.

1 participant