iOS session replay records a Mapbox `UiKitView` as a black box, even with `maskAllPlatformViews = false`
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 52/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Lĩnh vực
- mobile, observability
Hướng nghiên cứu
Bắt đầu với screenshot_capturer.dart ở dòng 419 và 610, sau đó kiểm tra darwin/.../PosthogFlutterPlugin.swift quanh captureOneNative tại dòng 744. Tái hiện trường hợp Mapbox UiKitView và lần theo đường đi captured-to-nil-to-mask. Hoàn tất khi một iOS platform view không bị che xuất hiện trong bản replay, trong khi các platform views bị che vẫn được bảo vệ.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Version
5.44.2
Steps to Reproduce
Environment: posthog_flutter 5.44.2, mapbox_maps_flutter 2.24.3, Flutter stable, iOS 27.0 simulator (iPhone 18 Pro).
- Add a
mapbox_maps_flutterMapWidgetto a screen. On iOS that plugin renders a plainUiKitView— the only iOS branch, with no texture-mode option (lib/src/mapbox_maps_platform.dart:80):
} else if (defaultTargetPlatform == TargetPlatform.iOS) {
return UiKitView(
viewType: 'plugins.flutter.io/mapbox_maps',
...
- Enable session replay with every mask off:
await Posthog().setup(
PostHogConfig('<token>')
..sessionReplay = true
..sessionReplayConfig = (PostHogSessionReplayConfig()
..maskAllTexts = false
..maskAllImages = false
..maskAllPlatformViews = false
..captureNativeScreens = true),
);
- Wrap the app in
PostHogWidget, run on an iOS simulator, and open the screen with the map. - Watch the resulting replay.
Wrapping the map in PostHogPlatformView(privacy: PostHogPlatformViewPrivacy.capture) makes no difference.
Related
Related to #151, which tracked platform view recording and was closed in July 2026 after PR #453 and #473. On iOS the reveal path only covers WKWebView, so the Mapbox case from that thread still reproduces — a maintainer had linked the "Flutter iOS Google Maps does not visible in session replay" question there as the same problem.
Questions
- Is non-WebView platform view capture planned for iOS, or is WebView-only the intended scope? If the latter,
maskAllPlatformViewsshould document it. - Could
drawHierarchy(in:afterScreenUpdates:)be gated on no masked platform view intersecting the crop rect, keeping the leak protection for mixed screens while letting the fully-unmasked case work?
Expected Result
The map appears in the replay, since platform view masking is disabled globally and maskAllPlatformViews is documented as a global opt-out with no iOS caveat.
Actual Result
The map is a solid black rectangle exactly its own size, while the debug log claims the opposite:
flutter: Found 0 masked and 1 captured platform view rect(s)
That mismatch is what makes this hard to diagnose from the app side: the SDK reports the view as captured, and the replay shows it masked.
Cause. Dart classifies the UiKitView as captured and asks native to screenshot the rect (screenshot_capturer.dart:610). captureOneNative searches that rect for a WKWebView, finds none, and returns nil (darwin/.../PosthogFlutterPlugin.swift:744):
// No WKWebView found for the captured rect. Returning nil here
// keeps this safe: drawHierarchy over the full window would
// include any masked CALayer-backed platform view overlapping
// the crop region and leak it into replay.
onResult(nil)
Dart reads nil as "capture failed" and paints the mask anyway (screenshot_capturer.dart:419):
if (bytes == null) {
_imageMaskPainter.drawMaskedImage(canvas, [fallbackMask], pixelRatio);
return;
}
So the view round-trips captured → declined → re-masked, with the log line emitted before the decline.
I have only tested Mapbox, so I can't speak to other plugins, but the WebView-only check is not Mapbox-specific. I have not tested Android either, though its captureOneNative composites platform-view SurfaceViews rather than restricting to web views (android/.../PosthogFlutterPlugin.kt:1216-1221), so the platforms appear to differ.
- Ngôn ngữ chính
- Dart
- Star
- 99
- Fork
- 94
- Merge trung bình
- 2 ngày 4 giờ
- Pull request đã merge (30 ngày)
- 65
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của PostHog/posthog-flutter
-
Android bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
PostHog/posthog-flutter#731 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
dependencies enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
PostHog/posthog-flutter#377 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement feature/error-tracking
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 28/100
PostHog/posthog-flutter#623 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Support widgetĐang mởenhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 30/100
PostHog/posthog-flutter#596 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Session replay: support v2 trigger groups (conditional recording)Có thể đã có người làm @marc-merino đã nhận 39 ngày trước. Đang mởenhancement feature/replay
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
PostHog/posthog-flutter#545 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của PostHog/posthog-flutter
Issue tương tự
-
bug enhancement needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
-
bug from-telegram platform:windows
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
hiddify/hiddify-app#2592 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
cogwheel0/conduit#1122 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
夜間レビュー: 観点 tests の指摘 (PR #774)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
bannzai/shoppinglist#779 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] JEFIT import fails because # characters are not recognisedCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởbug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày