Description
When setting up the sentry-cocoa SDK, there are multiple touch points for the user, especially the sentry-wizard, the auto and manual "getting started" guide in Sentry and the page in user documentation.
In any case, we want the user to send their first event to create their first issue to further explore Sentry.
When using the sentry-wizard for Apple, it injects the dependency into the Xcode project, adds a user build script to upload debug symbols and injects the setup script.
To verify the setup works we promote different scripts:
sentry-wizard:
The snippet which is injected into the code by the wizard uses SentrySDK.capture(message:)
to create the first issue:
// Remove the next line after confirming that your Sentry integration is working.
SentrySDK.capture(message: "This app uses Sentry! :)")\n`;
Furthermore the options also include these ones by default:
// Uncomment the following lines to add more data to your events
// options.attachScreenshot = true // This adds a screenshot to the error events
// options.attachViewHierarchy = true // This adds the view hierarchy to the error events
IIRC we need to add options.sendDefaultPii = true
too.
sentry-docs:
The following code is not copy-paste friendly, because it requires the user to create an additional method aMethodThatMightFail()
which is also declared as might fail, while we want it to fail definitely (to create the first issue):
import Sentry
do {
try aMethodThatMightFail()
} catch {
SentrySDK.capture(error: error)
}
Ref: https://docs.sentry.io/platforms/apple/guides/ios/#verify
It would make more sense to either create an error or capture a message:
Option 1:
// Errors in Swift are declared as an enum
enum MyCustomError: Error {
case myFirstIssue
}
do {
throw MyCustomError.myFirstIssue
} catch {
SentrySDK.capture(error: error)
}
// Create and capture an error - Option 2
Option 2:
// Fallback to the Objective-C/NextStep runtime errors
// This works but not really Swift-like
let error = NSError(domain: "my.error.domain", code: 1)
SentrySDK.capture(error: error)
sentry:
The verification snippet is only useful for apps using UIKit, requiring users to know how to setup a button in their UI, which might be disruptive for the existing user interface.
I believe we need to discuss the different approaches, keep in mind their value at different positions and update accordingly
Metadata
Metadata
Assignees
Type
Projects
Status