diff --git a/docs/platforms/apple/common/index.mdx b/docs/platforms/apple/common/index.mdx index 865aa81806af0..224af11bf9520 100644 --- a/docs/platforms/apple/common/index.mdx +++ b/docs/platforms/apple/common/index.mdx @@ -311,6 +311,31 @@ func applicationDidFinishLaunching() { ``` + + +## 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 capturing uncaught exceptions 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; +}]; +``` + + + ## 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) { } ``` - - -## Uncaught Exceptions - -On macOS, the Sentry Apple SDK can't capture uncaught exceptions out of the box. Please visit capturing uncaught exceptions for more information. - - ## Next Steps