Skip to content

Screenshot capture crashes with invalid bounds in SwiftUI views during transitions #45

Description

@guitaripod

Environment

  • Shake iOS SDK version: 17.2.2
  • iOS version: 17+, 18+
  • SwiftUI application

Description

The SDK crashes when capturing screenshots in SwiftUI views with complex hierarchies during view transitions. The crash occurs due to invalid view bounds in transitional states.

Affected view structure:

  • TabView with PageTabViewStyle
  • AVPlayerViewController via UIViewControllerRepresentable
  • Overlay layers with transitions

Workaround

.onAppear {
    Shake.configuration.isScreenshotIncluded = false
}
.onDisappear {
    Shake.configuration.isScreenshotIncluded = true
}

Feature Request

  1. Defensive screenshot capture: Handle invalid/transitional view bounds gracefully (skip or retry) rather than crashing.

  2. SwiftUI-compatible private view API: The addPrivateView() API is documented as unavailable for SwiftUI. A SwiftUI modifier to exclude views from screenshots would be useful.

Happy to provide more details or test fixes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions