Skip to content

fix(ios): use framework-style import for SentrySwizzle.h#6181

Merged
alwx merged 1 commit into
mainfrom
alwx/fix/sentry-swizzle
May 18, 2026
Merged

fix(ios): use framework-style import for SentrySwizzle.h#6181
alwx merged 1 commit into
mainfrom
alwx/fix/sentry-swizzle

Conversation

@alwx
Copy link
Copy Markdown
Contributor

@alwx alwx commented May 18, 2026

The quote-style #import "SentrySwizzle.h" only resolves when sentry-cocoa is consumed via CocoaPods source build, where the header sits on the HEADER_SEARCH_PATHS. When sentry-cocoa is consumed as a pre-built xcframework (via SPM binaryTarget or manual drop-in), the header lives in the framework's PrivateHeaders/ directory and the quote-style import fails.

It's required for the sentry-cocoa SPM consumption: #6170.

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

📝 Checklist

  • I added tests to verify changes
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • All tests passing
  • No breaking changes

🔮 Next steps

The quote-style `#import "SentrySwizzle.h"` only resolves when sentry-cocoa
is consumed via CocoaPods source build, where the header sits on the
HEADER_SEARCH_PATHS. When sentry-cocoa is consumed as a pre-built xcframework
(via SPM `binaryTarget` or manual drop-in), the header lives in the
framework's `PrivateHeaders/` directory and the quote-style import fails:

    error: 'SentrySwizzle.h' file not found

Apple's framework header lookup considers both `Headers/` and `PrivateHeaders/`
when using framework-style imports, so `<Sentry/SentrySwizzle.h>` resolves
correctly in both distribution modes.

This is a no-regression change: the CocoaPods source build continues to
work, verified by building RNSentry against sentry-cocoa 9.13.0 (`pod
install` + `xcodebuild`). It also unblocks one of the two issues found
during the SPM consumption spike at
#6170.
@alwx alwx self-assigned this May 18, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 18, 2026

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): use framework-style import for SentrySwizzle.h by alwx in #6181
  • chore(deps): bump actions/create-github-app-token from 3.1.1 to 3.2.0 by dependabot in #6178
  • chore(deps): bump github/codeql-action from 4.35.4 to 4.35.5 by dependabot in #6176
  • chore(deps): bump getsentry/craft from 2.26.3 to 2.26.5 by dependabot in #6179
  • chore(deps): bump getsentry/craft/.github/workflows/changelog-preview.yml from 2.26.3 to 2.26.5 by dependabot in #6177
  • fix(core): Resolve expo CLI directly instead of using npx in sourcemap upload by antonis in #6155
  • feat(core): Surface textComponentNames option in Metro config by antonis in #6169
  • chore(deps): update Sentry Android Gradle Plugin to v6.7.0 by github-actions in #6153
  • Filter ExceptionsManager.reportException duplicates in app-start init by alwx in #6145
  • chore(deps): update JavaScript SDK to v10.53.1 by github-actions in #6139
  • feat(core): Enable autoInjectSentryLabel by default in Metro config by antonis in #6141
  • feat(core): Respect Mask boundaries when reading sentry-label by antonis in #6142
  • fix(android): Handle boolean values in JSON options converter by antonis in #6130
  • Multi-instance <TimeToInitialDisplay> / <TimeToFullDisplay> coordination; a multi-signal TTID/TTFD system by alwx in #6090
  • chore(deps): update Bundler Plugins to v5.3.0 by github-actions in #6138
  • chore: Merge 8.11.1 back to main by antonis in #6135
  • chore: Update warning regarding iOS crash in sentry-cocoa 9.12.0 by antonis in #6136
  • chore(deps): update CLI to v3.4.2 by github-actions in #6129
  • chore(deps): bump getsentry/craft/.github/workflows/changelog-preview.yml from 2.26.2 to 2.26.3 by dependabot in #6126
  • chore(deps): bump getsentry/craft from 2.26.2 to 2.26.3 by dependabot in #6127
  • chore(deps): bump github/codeql-action from 4.35.3 to 4.35.4 by dependabot in #6128
  • feat(core): Extract text from children of touched components for breadcrumb labels by antonis in #6106
  • chore(deps): bump @babel/plugin-transform-modules-systemjs from 7.25.0 to 7.29.4 by dependabot in #6124
  • chore(deps): bump fast-uri from 3.0.1 to 3.1.2 by dependabot in #6121

Plus 6 more


🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 18, 2026

Fails
🚫

CHANGELOG.md#L4278 - The changelog entry seems to be part of an already released section ## 8.11.1.
Consider moving the entry to the ## Unreleased section, please.

Generated by 🚫 dangerJS against 81845cc

@antonis antonis added the ready-to-merge Triggers the full CI test suite label May 18, 2026
Copy link
Copy Markdown
Contributor

@antonis antonis left a comment

Choose a reason for hiding this comment

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

LGTM!
Let's leave the extra CI iOS checks to run just in case

@github-actions
Copy link
Copy Markdown
Contributor

iOS (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 3855.64 ms 1230.02 ms -2625.62 ms
Size 5.15 MiB 6.68 MiB 1.53 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
5fe1c6c+dirty 1220.79 ms 1217.63 ms -3.16 ms
7d8c8bd+dirty 3837.24 ms 1215.51 ms -2621.73 ms
df5d108+dirty 1225.90 ms 1220.14 ms -5.76 ms
23598c3+dirty 1207.00 ms 1209.90 ms 2.90 ms
bc0d8cf+dirty 3830.33 ms 1220.52 ms -2609.81 ms
5a21b51+dirty 3823.11 ms 1214.46 ms -2608.65 ms
3817909+dirty 1183.90 ms 1187.50 ms 3.60 ms
d2eadf8+dirty 3842.42 ms 1228.91 ms -2613.50 ms
5c1e987+dirty 1204.30 ms 1222.15 ms 17.85 ms
7d6fd3a+dirty 1223.29 ms 1229.57 ms 6.28 ms

App size

Revision Plain With Sentry Diff
5fe1c6c+dirty 3.38 MiB 4.77 MiB 1.39 MiB
7d8c8bd+dirty 5.15 MiB 6.68 MiB 1.53 MiB
df5d108+dirty 3.38 MiB 4.73 MiB 1.35 MiB
23598c3+dirty 3.38 MiB 4.80 MiB 1.42 MiB
bc0d8cf+dirty 5.15 MiB 6.67 MiB 1.51 MiB
5a21b51+dirty 5.15 MiB 6.67 MiB 1.51 MiB
3817909+dirty 3.38 MiB 4.73 MiB 1.35 MiB
d2eadf8+dirty 5.15 MiB 6.67 MiB 1.51 MiB
5c1e987+dirty 3.38 MiB 4.73 MiB 1.35 MiB
7d6fd3a+dirty 3.38 MiB 4.77 MiB 1.39 MiB

@sentry
Copy link
Copy Markdown

sentry Bot commented May 18, 2026

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
Sentry RN io.sentry.reactnative.sample 8.11.1 (88) Release

⚙️ sentry-react-native Build Distribution Settings

@alwx alwx merged commit 1605536 into main May 18, 2026
101 of 114 checks passed
@alwx alwx deleted the alwx/fix/sentry-swizzle branch May 18, 2026 15:12
@antonis
Copy link
Copy Markdown
Contributor

antonis commented May 19, 2026

@alwx I think we'll need to temporarily revert the change since it causes build failures with some configurations

[ReactAppDependencyProvider] Generating ReactAppDependencyProvider.framework.dSYM
Error: 'Sentry/SentrySwizzle.h' file not found (in target 'RNSentry' from project 'Pods')
** BUILD FAILED **

It's required for the sentry-cocoa SPM consumption: #6170.

We can make the change on a feature branch if needed to avoid blocking the release process later this week.

Copy link
Copy Markdown
Contributor

@antonis antonis left a comment

Choose a reason for hiding this comment

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

Probably we can use a __has_include similar to this like:

#if __has_include(<Sentry/SentrySwizzle.h>)
#    import <Sentry/SentrySwizzle.h>
#else
#    import "SentrySwizzle.h"
#endif

I'll test this out in #6186 🤞

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge Triggers the full CI test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants