Skip to content

feat(apple): Docs for resume and pause AppHangs #10409

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 5 commits into from
Jun 25, 2024
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: 32 additions & 0 deletions docs/platforms/apple/common/configuration/app-hangs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ description: "Learn about how to add app hang detection reporting."

We recommend disabling this feature for Widgets and Live Activities because it might detect false positives.

Furthermore, the Cocoa SDK might report app hangs when the OS opens a system dialog asking for specific permissions,
such as whether the user wants to allow your app to paste from the clipboard. As we can't reliably detect these scenarios,
we advise you to [pause and resume tracking app hangs](#pause-and-resume-app-hang-tracking) to circumvent this problem.

</Note>

This integration tracks app hangs. This feature is available on iOS, tvOS, and macOS.
Expand Down Expand Up @@ -101,3 +105,31 @@ SentrySDK.start { options in
}];

```

### Pause and Resume App Hang Tracking

Starting with version 8.30.0, you can pause and resume app hang tracking at runtime with `SentrySDK.pauseAppHangTracking()` and `SentrySDK.resumeAppHangTracking()`.
These methods don't stop the <PlatformLink to="/configuration/metric-kit">MetricKit</PlatformLink> integration from reporting [MXHangDiagnostic](https://developer.apple.com/documentation/metrickit/mxhangdiagnostic).

```swift {tabTitle:Swift}
import Sentry

SentrySDK.pauseAppHangTracking()

// Do something that might cause the app to hang,
// and you don't want the Cocoa SDK to report it.

SentrySDK.resumeAppHangTracking()
```

```objc {tabTitle:Objective-C}
@import Sentry;

[SentrySDK pauseAppHangTracking];

// Do something that might cause the app to hang,
// and you don't want the Cocoa SDK to report it.

[SentrySDK resumeAppHangTracking];

```
Loading