sentry-cocoa icon indicating copy to clipboard operation
sentry-cocoa copied to clipboard

Capture Screenshot and ViewHierarchy for single events

Open philipphofmann opened this issue 1 year ago • 4 comments

Description

We could add an API similar to the following:

Attachment.captureScreenshot()
Attachment.captureViewHierarchy()

Then users could use the local scope to capture screenshots and view hierarchy for single events like this

SentrySDK.captureMessage(message: "my message", block: { scope in
	scope.addAttachment(Attachment.captureScreenshot())
})

Consider creating issues for all mobile platforms to have a consistent API.

Also, update the docs:

  1. https://docs.sentry.io/platforms/apple/enriching-events/attachments/
  2. https://docs.sentry.io/platforms/apple/guides/ios/enriching-events/screenshots/https://docs.sentry.io/platforms/apple/guides/ios/enriching-events/viewhierarchy/

Please upvote if you want this feature.

philipphofmann avatar May 08 '23 08:05 philipphofmann

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

github-actions[bot] avatar May 30 '23 00:05 github-actions[bot]

This feature is still important to me, and I understand that it seems like there are already other implementations for other platforms, but only iOS doesn't have it yet? If so that's pretty bad, looking forward to seeing it on iOS soon.

rakuyoMo avatar Aug 10 '23 01:08 rakuyoMo

Hi @rakuyoMo - this specific feature is generally not available yet. We use this issue to track demand and might bump priority if it receives more upvotes.

On other platforms, Hints can be used to conditionally send Screenshots and/or View Hierarchies by filtering based on Hints in beforeSend. We have an issue open for implementing Hints on sentry-cocoa: https://github.com/getsentry/sentry-cocoa/issues/2325

kahest avatar Aug 10 '23 13:08 kahest

Related issue to add a beforeCapture callback: https://github.com/getsentry/sentry-cocoa/issues/3137

kahest avatar Jan 16 '24 13:01 kahest