Skip to content

fix(ios): Use conditional import for SentrySwizzle.h#6186

Merged
antonis merged 1 commit into
mainfrom
fix/ios-sentry-swizzle-conditional-import
May 19, 2026
Merged

fix(ios): Use conditional import for SentrySwizzle.h#6186
antonis merged 1 commit into
mainfrom
fix/ios-sentry-swizzle-conditional-import

Conversation

@antonis
Copy link
Copy Markdown
Contributor

@antonis antonis commented May 19, 2026

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

📜 Description

Uses __has_include to conditionally import SentrySwizzle.h with framework-style (<Sentry/SentrySwizzle.h>) when available, falling back to quote-style ("SentrySwizzle.h") otherwise.

SentrySwizzle.h is a private header in sentry-cocoa (lives in Sources/Sentry/include/, not Sources/Sentry/Public/). The previous fix in #6181 switched to a framework-style import unconditionally, which broke CocoaPods source builds because private headers aren't exposed via <Framework/...> in that configuration. It was reverted.

Neither import style works for all consumption methods:

Import style CocoaPods (source) SPM xcframework
#import "SentrySwizzle.h"
#import <Sentry/SentrySwizzle.h>

The conditional __has_include resolves this by using whichever path is available at compile time.

💡 Motivation and Context

Fixes the build regression from #6181 while still supporting SPM xcframework consumption (#6170, #6182).

💚 How did you test it?

  • CocoaPods source build should resolve via the quote-style fallback (existing behavior)
  • SPM xcframework build should resolve via the framework-style import

📝 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

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

github-actions Bot commented May 19, 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 conditional import for SentrySwizzle.h by antonis in #6186
  • 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

Plus 7 more


🤖 This preview updates automatically when you update the PR.

…CocoaPods and SPM

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@antonis antonis force-pushed the fix/ios-sentry-swizzle-conditional-import branch from 2cca6b4 to a4d4e44 Compare May 19, 2026 07:30
Copy link
Copy Markdown
Contributor Author

@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.

Skipping changelog since this is an internal change that hasn't been shipped.

@sentry
Copy link
Copy Markdown

sentry Bot commented May 19, 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

@github-actions
Copy link
Copy Markdown
Contributor

iOS (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 3829.71 ms 1222.76 ms -2606.95 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 1201.36 ms 1209.15 ms 7.78 ms
7d8c8bd+dirty 3847.98 ms 1230.77 ms -2617.21 ms
df5d108+dirty 1207.34 ms 1210.50 ms 3.16 ms
23598c3+dirty 1223.59 ms 1229.13 ms 5.53 ms
bc0d8cf+dirty 3834.64 ms 1223.91 ms -2610.73 ms
5a21b51+dirty 3837.87 ms 1223.47 ms -2614.40 ms
3817909+dirty 1210.76 ms 1215.64 ms 4.89 ms
d2eadf8+dirty 3841.53 ms 1216.15 ms -2625.39 ms
5c1e987+dirty 1208.43 ms 1220.72 ms 12.29 ms
7d6fd3a+dirty 1210.89 ms 1217.63 ms 6.74 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

@github-actions
Copy link
Copy Markdown
Contributor

iOS (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 3833.50 ms 1220.38 ms -2613.12 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

@antonis antonis marked this pull request as ready for review May 19, 2026 07:49
@antonis antonis merged commit 6177334 into main May 19, 2026
111 of 133 checks passed
@antonis antonis deleted the fix/ios-sentry-swizzle-conditional-import branch May 19, 2026 08:52
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 skip-changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants