-
-
Notifications
You must be signed in to change notification settings - Fork 363
fix(session-replay): Add exemption for CameraUI traversal for iOS 26.0 #6045
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Instructions and example for changelogPlease add an entry to Example: ## Unreleased
- Add exemption for CameraUI traversal for iOS 26.0 ([#6045](https://github.com/getsentry/sentry-cocoa/pull/6045)) If none of the above apply, you can opt out of this check by adding |
Sources/Swift/Core/Tools/ViewCapture/SentryUIRedactBuilder.swift
Outdated
Show resolved
Hide resolved
/// This workaround is specifically for Xcode 16 building for iOS 26 where accessing CameraUI.ModeLoupeLayer | ||
/// causes a crash due to unimplemented init(layer:) initializer. | ||
private static let cameraSwiftUIViewClassObjectId: ObjectIdentifier? = { | ||
guard let classType = NSClassFromString("CameraUI.ChromeSwiftUIView") else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
h
: When looking at the crash in #5647 it could be that simply calling NSClassFromString
could still lead to crashes. We had a weird issue in the past when swizzling UIViewControllers (#3798) and therefore we don't call it in the SentrySubClassFinder for excluded classes
sentry-cocoa/Sources/Sentry/SentrySubClassFinder.m
Lines 72 to 77 in 15a6325
// It is vital to avoid calling NSClassFromString for the excluded classes because we | |
// had crashes for specific classes when calling NSClassFromString, such as | |
// https://github.com/getsentry/sentry-cocoa/issues/3798. | |
if (shouldExcludeClassFromSwizzling) { | |
continue; | |
} |
I even opened a bug in the Swift repo but it never got fixed: swiftlang/swift#72657. I'm unsure if it's worth the effort to do this right now. Simply doing a check if we're running on iOS 26 could be safer.
❌ 104 Tests Failed:
View the top 3 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
Performance metrics 🚀
|
Revision | Plain | With Sentry | Diff |
---|---|---|---|
aa96485 | 1215.37 ms | 1234.04 ms | 18.67 ms |
acac774 | 1217.76 ms | 1253.29 ms | 35.52 ms |
5ec90e0 | 1235.57 ms | 1258.45 ms | 22.88 ms |
04ff3ec | 1220.71 ms | 1253.86 ms | 33.15 ms |
67e8e3e | 1220.08 ms | 1229.23 ms | 9.15 ms |
b13e93a | 1236.24 ms | 1247.33 ms | 11.08 ms |
51b7dd3 | 1235.06 ms | 1258.21 ms | 23.15 ms |
b57ee62 | 1218.21 ms | 1248.94 ms | 30.73 ms |
884b224 | 1233.41 ms | 1259.50 ms | 26.09 ms |
7fc6927 | 1221.21 ms | 1242.36 ms | 21.15 ms |
App size
Revision | Plain | With Sentry | Diff |
---|---|---|---|
aa96485 | 23.75 KiB | 874.46 KiB | 850.71 KiB |
acac774 | 23.75 KiB | 866.51 KiB | 842.76 KiB |
5ec90e0 | 23.74 KiB | 872.67 KiB | 848.92 KiB |
04ff3ec | 23.75 KiB | 880.26 KiB | 856.52 KiB |
67e8e3e | 23.75 KiB | 919.91 KiB | 896.16 KiB |
b13e93a | 23.75 KiB | 855.37 KiB | 831.62 KiB |
51b7dd3 | 23.75 KiB | 913.26 KiB | 889.52 KiB |
b57ee62 | 23.75 KiB | 912.47 KiB | 888.72 KiB |
884b224 | 23.75 KiB | 879.60 KiB | 855.86 KiB |
7fc6927 | 23.75 KiB | 908.54 KiB | 884.79 KiB |
Using |
📜 Description
This pull request introduces a targeted workaround in the
SentryUIRedactBuilder
to handle a crash related toCameraUI.ChromeSwiftUIView
on iOS 26 when built with Xcode 16. The workaround ensures that the redaction process skips subtrees of this specific internal camera view to prevent the crash, while maintaining normal redaction behavior for other views.Camera view crash workaround (iOS 26, Xcode 16+):
SentryUIRedactBuilder
to detect and skip subtrees ofCameraUI.ChromeSwiftUIView
when running on iOS 26+ to prevent crashes from unimplemented initializers. (cameraSwiftUIViewClassObjectId
,isViewSubtreeIgnored
,redactRegionsFor(view:)
) [1] [2] [3]Redaction logic improvements:
view.debugDescription
instead oflayer.name
for more consistent identification. [1] [2]Unit tests for workaround and redaction:
Camera UI integration (demo/sample):
ErrorsViewController.swift
to present the camera UI usingUIImagePickerController
for testing camera permission flows.💡 Motivation and Context
Fixes #5647
💚 How did you test it?
📝 Checklist
You have to check all boxes before merging:
sendDefaultPII
is enabled.