Skip to content

Commit 263ca6d

Browse files
feat(apple): Code for NSExceptions in configure (#13941)
1 parent 7249825 commit 263ca6d

File tree

1 file changed

+25
-7
lines changed

1 file changed

+25
-7
lines changed

docs/platforms/apple/common/index.mdx

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,31 @@ func applicationDidFinishLaunching() {
311311
```
312312
</PlatformSection>
313313

314+
<PlatformSection supported={[ "apple.macos"]}>
315+
316+
## Uncaught NSExceptions
317+
318+
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.
319+
320+
```swift {tabTitle:Swift}
321+
import Sentry
322+
323+
SentrySDK.start { options in
324+
options.dsn = "___PUBLIC_DSN___"
325+
options.enableUncaughtNSExceptionReporting = true
326+
}
327+
```
328+
```objc {tabTitle:Objective-C}
329+
@import Sentry;
330+
331+
[SentrySDK startWithConfigureOptions:^(SentryOptions *options) {
332+
options.dsn = @"___PUBLIC_DSN___";
333+
options.enableUncaughtNSExceptionReporting = YES;
334+
}];
335+
```
336+
337+
</PlatformSection>
338+
314339
## Verify
315340
316341
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) {
342367
}
343368
```
344369
345-
<PlatformSection supported={[ "apple.macos"]}>
346-
347-
## Uncaught Exceptions
348-
349-
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.
350-
351-
</PlatformSection>
352370
353371
## Next Steps
354372

0 commit comments

Comments
 (0)