Skip to content

feat(apple): Code for NSExceptions in configure #13941

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 25 additions & 7 deletions docs/platforms/apple/common/index.mdx
Original file line number Diff line number Diff line change
@@ -311,6 +311,31 @@ func applicationDidFinishLaunching() {
```
</PlatformSection>

<PlatformSection supported={[ "apple.macos"]}>

## Uncaught NSExceptions

On macOS, the Sentry Apple SDK can't capture uncaught exceptions out of the box, therefore we recommend enabling `enableUncaughtNSExceptionReporting` in your `SentryOptions`. Alternatively, you can use the `SentryCrashExceptionApplication` class. Please visit <PlatformLink to="/usage/#capturing-uncaught-exceptions">capturing uncaught exceptions</PlatformLink> for more information.

```swift {tabTitle:Swift}
import Sentry

SentrySDK.start { options in
options.dsn = "___PUBLIC_DSN___"
options.enableUncaughtNSExceptionReporting = true
}
```
```objc {tabTitle:Objective-C}
@import Sentry;

[SentrySDK startWithConfigureOptions:^(SentryOptions *options) {
options.dsn = @"___PUBLIC_DSN___";
options.enableUncaughtNSExceptionReporting = YES;
}];
```

</PlatformSection>

## Verify

Verify that your app is sending events to Sentry by adding the following snippet, which includes an intentional error. You should see the error reported in Sentry within a few minutes.
@@ -342,13 +367,6 @@ if (error) {
}
```

<PlatformSection supported={[ "apple.macos"]}>

## Uncaught Exceptions

On macOS, the Sentry Apple SDK can't capture uncaught exceptions out of the box. Please visit <PlatformLink to="/usage/#capturing-uncaught-exceptions">capturing uncaught exceptions</PlatformLink> for more information.

</PlatformSection>

## Next Steps