View Hierarchy

When a user experiences an error, Sentry provides the ability to render an ASCII represention of your view hierarchy and include it as an attachment.

This feature only applies to SDKs with a user interface, such as the ones for mobile and desktop applications. In some environments like native iOS, rendering the view hierarchy requires the UI thread and in the event of a crash, that might not be available. Another example where the view hierarchy might not be available is when the event happens before the screen starts to load. So inherently, this feature is a best effort solution.

Enabling View Hierarchy Attachments

View hierarchy debugging is an opt-in feature. You can enable it as shown below:

Copied
import Sentry

SentrySDK.start { options in
  options.attachViewHierarchy = true
}

Viewing View Hierarchy Attachments

View hierarchies appear in the "Attachments" tab, where you can view all attachments, as well as associated events. Click the event ID to open the Issue Details page of that specific event.

Screenshots List Example

Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) to suggesting an update ("yeah, this would be better").