fix(ios): use framework-style import for SentrySwizzle.h#6181
Merged
Conversation
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.
Contributor
Semver Impact of This PR⚪ None (no version bump detected) 📋 Changelog PreviewThis is how your changes will appear in the changelog.
Plus 6 more 🤖 This preview updates automatically when you update the PR. |
Contributor
antonis
approved these changes
May 18, 2026
Contributor
antonis
left a comment
There was a problem hiding this comment.
LGTM!
Let's leave the extra CI iOS checks to run just in case
Contributor
iOS (legacy) Performance metrics 🚀
|
| 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 |
📲 Install BuildsAndroid
|
Contributor
|
@alwx I think we'll need to temporarily revert the change since it causes build failures with some configurations
We can make the change on a feature branch if needed to avoid blocking the release process later this week. |
10 tasks
antonis
reviewed
May 19, 2026
Contributor
antonis
left a comment
There was a problem hiding this comment.
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 🤞
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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 SPMbinaryTargetor manual drop-in), the header lives in the framework'sPrivateHeaders/directory and the quote-style import fails.It's required for the sentry-cocoa SPM consumption: #6170.
📢 Type of change
📝 Checklist
sendDefaultPIIis enabled🔮 Next steps