Skip to content

Commit a2585ce

Browse files
antonisclaude
andauthored
revert(ios): Revert "Migrate from PrivateSentrySDKOnly to SentrySDK.internal (#6380)" (#6491)
This reverts #6380 (eae9020), restoring the pre-8.19.0 iOS native behavior. #6380 made RNSentry access SentrySDK.internal before SentrySDK.start (during init, from RNSentryStart and from JS integrations calling native methods like fetchNativeAppStart/fetchNativeSdkInfo). Constructing SentrySDK.internal eagerly reads SentryDependencyContainer.screenshotSource — a lazy var that returns and permanently caches nil while startOptions is unset — breaking all iOS screenshot capture (Feedback Widget screenshot, attachScreenshot, Sentry.captureScreenshot). A targeted RN-side revert is unreliable (any pre-start SentrySDK.internal access poisons the lazy var, and JS controls the timing), so revert the whole migration as the interim fix. The migration can be re-landed once the underlying sentry-cocoa issue is fixed (screenshotSource should not permanently cache nil). Fixes #6497. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent deca559 commit a2585ce

20 files changed

Lines changed: 178 additions & 491 deletions

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010

1111
### Fixes
1212

13+
- Fix iOS screenshots no longer being captured since 8.19.0 (Feedback Widget screenshot, `attachScreenshot`, `Sentry.captureScreenshot()`) by reverting the iOS `SentrySDK.internal` migration from #6380 ([#6491](https://github.com/getsentry/sentry-react-native/pull/6491), [#6497](https://github.com/getsentry/sentry-react-native/issues/6497))
1314
- Strip empty `turbo_module.name` / `turbo_module.method` tags in `turboModuleContextIntegration` so events captured outside an active TurboModule call no longer carry an ingestion "Processing Error" ([#6506](https://github.com/getsentry/sentry-react-native/pull/6506))
14-
1515
- Make `copySentryJsonConfiguration` and the `*_SentryUpload` Gradle tasks compatible with the Gradle Configuration Cache ([#6469](https://github.com/getsentry/sentry-react-native/pull/6469))
1616

1717
These tasks previously read `project` state at execution time — `onlyIf` predicates resolving closures from `project.extra`, plus `project.rootDir`, `project.copy`, `project.logger`, and `Project.file` inside task actions — which fails the build with `Could not evaluate onlyIf predicate` when `org.gradle.configuration-cache=true` (Gradle 9 defaults to recommending it). Environment reads are now captured at configuration time, file copies use an injected `FileSystemOperations`, and task actions use the task's own `logger`. No behaviour change. Interim step ahead of the full SAGP migration (getsentry/sentry-android-gradle-plugin#796).

dev-packages/e2e-tests/patch-scripts/rn.patch.podfile.js

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -63,27 +63,8 @@ if (currentMatch) {
6363
debug.log('Warning: Could not find platform :ios line to patch');
6464
}
6565

66-
// RNSentry now contains Swift code (via the RNSentryInternal bridge over
67-
// SentrySDK.internal). CocoaPods refuses to integrate a Swift pod against
68-
// non-modular ObjC dependencies (e.g. React-hermes on older RN versions),
69-
// so ensure the Podfile requests modular headers globally.
70-
let modularPatched = false;
71-
if (!content.includes('use_modular_headers!')) {
72-
const patched = content.replace(
73-
/prepare_react_native_project!\s*\n/,
74-
"prepare_react_native_project!\nuse_modular_headers!\n",
75-
);
76-
if (patched !== content) {
77-
content = patched;
78-
modularPatched = true;
79-
debug.log('Patching Podfile with use_modular_headers!');
80-
} else {
81-
debug.log('Warning: Could not find prepare_react_native_project! anchor to inject use_modular_headers!');
82-
}
83-
}
84-
8566
// Write the file if any changes were made
86-
if (shouldPatch || currentMatch || modularPatched) {
67+
if (shouldPatch || currentMatch) {
8768
fs.writeFileSync(args['pod-file'], content);
8869
debug.log('Podfile patched successfully!');
8970
} else {

packages/core/RNSentry.podspec

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,23 @@ Pod::Spec.new do |s|
4646
# in `android/CMakeLists.txt`. The files are guarded with
4747
# `RCT_NEW_ARCH_ENABLED` so they compile to empty TUs on Old Arch.
4848
#
49-
# Swift is compiled unconditionally because `RNSentryInternal.swift` is
50-
# the sole ObjC↔Swift bridge over `SentrySDK.internal.*` — every `.m`/
51-
# `.mm` file in this pod calls into it. That makes RNSentry a Swift pod
52-
# in CocoaPods' eyes, which in turn requires modular headers from its
53-
# ObjC dependencies. Users on React Native < 0.75 (where `React-hermes`
54-
# and friends aren't modularized by default) must add
55-
# `use_modular_headers!` to their Podfile — see CHANGELOG.
56-
s.source_files = 'ios/**/*.{h,m,mm,swift}', 'cpp/**/*.{h,cpp}'
57-
s.swift_versions = ['5.5']
49+
# We include `.swift` (for `RNSentrySwiftLinkStub.swift`) only on RN >=
50+
# 0.75. Adding a Swift file makes CocoaPods treat RNSentry as a Swift
51+
# pod, which then requires modular headers from its ObjC dependencies
52+
# (React-Core, React-hermes) — RN < 0.75 doesn't emit those, so
53+
# `pod install` fails with:
54+
# "The Swift pod `RNSentry` depends upon `React-hermes`, which does
55+
# not define modules."
56+
# The stub is only needed when linking Sentry.xcframework's Swift
57+
# symbols into a dynamic framework anyway (RN 0.86+ `use_frameworks!
58+
# :dynamic`), so gating on RN 0.75 is safe.
59+
supports_swift_stub = rn_version[:major] >= 1 || (rn_version[:major] == 0 && rn_version[:minor] >= 75)
60+
if supports_swift_stub
61+
s.source_files = 'ios/**/*.{h,m,mm,swift}', 'cpp/**/*.{h,cpp}'
62+
s.swift_versions = ['5.5']
63+
else
64+
s.source_files = 'ios/**/*.{h,m,mm}', 'cpp/**/*.{h,cpp}'
65+
end
5866
s.public_header_files = 'ios/RNSentry.h', 'ios/RNSentrySDK.h', 'ios/RNSentryStart.h', 'ios/RNSentryVersion.h', 'ios/RNSentryBreadcrumb.h', 'ios/RNSentryReplay.h', 'ios/RNSentryReplayBreadcrumbConverter.h', 'ios/Replay/RNSentryReplayMask.h', 'ios/Replay/RNSentryReplayUnmask.h', 'ios/RNSentryTimeToDisplay.h'
5967

6068
s.compiler_flags = other_cflags

packages/core/RNSentryCocoaTester/RNSentryCocoaTester.xcodeproj/project.pbxproj

Lines changed: 4 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10-
2639D71D3BD04F17B0BAC987 /* RNSentryTurboModulePerfControllerTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = E795057A6D534A80A9D06356 /* RNSentryTurboModulePerfControllerTests.mm */; };
1110
332D33472CDBDBB600547D76 /* RNSentryReplayOptionsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 332D33462CDBDBB600547D76 /* RNSentryReplayOptionsTests.swift */; };
1211
3339C4812D6625570088EB3A /* RNSentryUserTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3339C4802D6625570088EB3A /* RNSentryUserTests.m */; };
1312
336084392C32E382008CC412 /* RNSentryReplayBreadcrumbConverterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 336084382C32E382008CC412 /* RNSentryReplayBreadcrumbConverterTests.swift */; };
@@ -18,6 +17,7 @@
1817
33DEDFED2D8DC825006066E4 /* RNSentryOnDrawReporter+Test.mm in Sources */ = {isa = PBXBuildFile; fileRef = 33DEDFEC2D8DC820006066E4 /* RNSentryOnDrawReporter+Test.mm */; };
1918
33DEDFF02D9185EB006066E4 /* RNSentryTimeToDisplayTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33DEDFEF2D9185E3006066E4 /* RNSentryTimeToDisplayTests.swift */; };
2019
33F58AD02977037D008F60EA /* RNSentryTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 33F58ACF2977037D008F60EA /* RNSentryTests.m */; };
20+
2639D71D3BD04F17B0BAC987 /* RNSentryTurboModulePerfControllerTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = E795057A6D534A80A9D06356 /* RNSentryTurboModulePerfControllerTests.mm */; };
2121
AEFB00422CC90C4B00EC8A9A /* RNSentryBreadcrumbTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3360843C2C340C76008CC412 /* RNSentryBreadcrumbTests.swift */; };
2222
B4DEB41739F14AA38202D4D4 /* RNSentryUriValidationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3E3742693F7643C2ADE1BDF2 /* RNSentryUriValidationTests.m */; };
2323
B5859A50A3E865EF5E61465A /* libPods-RNSentryCocoaTesterTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 650CB718ACFBD05609BF2126 /* libPods-RNSentryCocoaTesterTests.a */; };
@@ -52,8 +52,8 @@
5252
33F58ACF2977037D008F60EA /* RNSentryTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNSentryTests.m; sourceTree = "<group>"; };
5353
3E3742693F7643C2ADE1BDF2 /* RNSentryUriValidationTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNSentryUriValidationTests.m; sourceTree = "<group>"; };
5454
650CB718ACFBD05609BF2126 /* libPods-RNSentryCocoaTesterTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-RNSentryCocoaTesterTests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
55-
E2321E7CFA55AB617247098E /* Pods-RNSentryCocoaTesterTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNSentryCocoaTesterTests.debug.xcconfig"; path = "Target Support Files/Pods-RNSentryCocoaTesterTests/Pods-RNSentryCocoaTesterTests.debug.xcconfig"; sourceTree = "<group>"; };
5655
E795057A6D534A80A9D06356 /* RNSentryTurboModulePerfControllerTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = RNSentryTurboModulePerfControllerTests.mm; sourceTree = "<group>"; };
56+
E2321E7CFA55AB617247098E /* Pods-RNSentryCocoaTesterTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNSentryCocoaTesterTests.debug.xcconfig"; path = "Target Support Files/Pods-RNSentryCocoaTesterTests/Pods-RNSentryCocoaTesterTests.debug.xcconfig"; sourceTree = "<group>"; };
5757
F48F26542EA2A481008A185E /* RNSentryEmitNewFrameEvent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = RNSentryEmitNewFrameEvent.h; path = ../ios/RNSentryEmitNewFrameEvent.h; sourceTree = SOURCE_ROOT; };
5858
F48F26552EA2A4D4008A185E /* RNSentryFramesTrackerListener.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = RNSentryFramesTrackerListener.h; path = ../ios/RNSentryFramesTrackerListener.h; sourceTree = SOURCE_ROOT; };
5959
FADF868E2EBD053E00D6652D /* SentrySDKWrapper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentrySDKWrapper.h; path = ../ios/SentrySDKWrapper.h; sourceTree = SOURCE_ROOT; };
@@ -169,7 +169,6 @@
169169
3360898929524164007C7730 /* Sources */,
170170
BB7D14838753E6599863899B /* Frameworks */,
171171
CC7959F3721CB3AD7CB6A047 /* [CP] Copy Pods Resources */,
172-
2AA6DCCDB9B6D20211E939EC /* [CP] Embed Pods Frameworks */,
173172
);
174173
buildRules = (
175174
);
@@ -215,23 +214,6 @@
215214
/* End PBXProject section */
216215

217216
/* Begin PBXShellScriptBuildPhase section */
218-
2AA6DCCDB9B6D20211E939EC /* [CP] Embed Pods Frameworks */ = {
219-
isa = PBXShellScriptBuildPhase;
220-
buildActionMask = 2147483647;
221-
files = (
222-
);
223-
inputFileListPaths = (
224-
"${PODS_ROOT}/Target Support Files/Pods-RNSentryCocoaTesterTests/Pods-RNSentryCocoaTesterTests-frameworks-${CONFIGURATION}-input-files.xcfilelist",
225-
);
226-
name = "[CP] Embed Pods Frameworks";
227-
outputFileListPaths = (
228-
"${PODS_ROOT}/Target Support Files/Pods-RNSentryCocoaTesterTests/Pods-RNSentryCocoaTesterTests-frameworks-${CONFIGURATION}-output-files.xcfilelist",
229-
);
230-
runOnlyForDeploymentPostprocessing = 0;
231-
shellPath = /bin/sh;
232-
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-RNSentryCocoaTesterTests/Pods-RNSentryCocoaTesterTests-frameworks.sh\"\n";
233-
showEnvVarsInLog = 0;
234-
};
235217
30F19D4E16BEEFEC68733838 /* [CP] Check Pods Manifest.lock */ = {
236218
isa = PBXShellScriptBuildPhase;
237219
buildActionMask = 2147483647;
@@ -352,23 +334,14 @@
352334
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
353335
MTL_FAST_MATH = YES;
354336
ONLY_ACTIVE_ARCH = YES;
355-
OTHER_CFLAGS = (
356-
"$(inherited)",
357-
"-DRCT_REMOVE_LEGACY_ARCH=1",
358-
);
359-
OTHER_CPLUSPLUSFLAGS = (
360-
"$(inherited)",
361-
"-DRCT_REMOVE_LEGACY_ARCH=1",
362-
);
363337
OTHER_LDFLAGS = (
364338
"$(inherited)",
365339
" ",
366340
);
367-
PODFILE_DIR = "$(SRCROOT)";
368341
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
369342
SDKROOT = iphoneos;
370343
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) DEBUG";
371-
USE_HERMES = true;
344+
USE_HERMES = false;
372345
};
373346
name = Debug;
374347
};
@@ -420,22 +393,13 @@
420393
IPHONEOS_DEPLOYMENT_TARGET = 12.4;
421394
MTL_ENABLE_DEBUG_INFO = NO;
422395
MTL_FAST_MATH = YES;
423-
OTHER_CFLAGS = (
424-
"$(inherited)",
425-
"-DRCT_REMOVE_LEGACY_ARCH=1",
426-
);
427-
OTHER_CPLUSPLUSFLAGS = (
428-
"$(inherited)",
429-
"-DRCT_REMOVE_LEGACY_ARCH=1",
430-
);
431396
OTHER_LDFLAGS = (
432397
"$(inherited)",
433398
" ",
434399
);
435-
PODFILE_DIR = "$(SRCROOT)";
436400
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
437401
SDKROOT = iphoneos;
438-
USE_HERMES = true;
402+
USE_HERMES = false;
439403
VALIDATE_PRODUCT = YES;
440404
};
441405
name = Release;

0 commit comments

Comments
 (0)