User Feedback
The user feedback API provides the ability to collect user information when an event occurs. Sentry pairs the feedback with the original event, giving you additional insight into issues.
Sentry needs the eventId
to be able to associate the user feedback to the corresponding event. To get the eventId
, for example, you can use the beforeSend or the return value of the methods capturing an event.
Copied
import Sentry
let eventId = SentrySDK.capture(message: "My message.")
let userFeedback = UserFeedback(eventId: eventId)
userFeedback.comments = "It broke."
userFeedback.email = "john.doe@example.com"
userFeedback.name = "John Doe"
SentrySDK.capture(userFeedback: userFeedback)
To capture user feedback regarding a crash, use the SentryOptions.onCrashedLastRun
callback.
This callback gets called shortly after the initialization of the SDK when the last
program execution terminated with a crash. It is not guaranteed that this is called on the main thread.
Copied
import Sentry
SentrySDK.start { options in
options.dsn = "https://examplePublicKey@o0.ingest.sentry.io/0"
options.onCrashedLastRun = { event in
// capture user feedback
}
}
You can edit this page on GitHub.
- Package:
- cocoapods:sentry-cocoa
- Version:
- 6.0.12
- Repository:
- https://github.com/getsentry/sentry-cocoa