App Hangs

This integration tracks app hangs. This feature is available on iOS, tvOS, and macOS.

There are many reasons an app can become unresponsive, from long running code to an infinite loop bug, and this can be frustrating to the end user. With app hang tracking, you can detect and fix this problem.

The app hang detection integration has a default timeout of two (2) seconds. This means, that if the app is unresponsive for two seconds or more, the SDK creates an error event. With 7.24.0, we've improved the algorithm to detect app hangs sooner, decreasing it from appHangTimeoutInterval * 2 to appHangTimeoutInterval * 1.2.

The event has the stack trace of all running threads so you can easily detect where the problem occurred. The SDK reports an app hang immediately but doesn't report the exact duration because the watchdog could kill the app any time when blocking the main thread.

The app hangs code runs in the background when disabled when keeping watchdog termination tracking enabled, but it won't report app hangs. The watchdog termination tracking otherwise would report false errors if the OS kills your app caused by an app hang.

Because the app hang detection integration uses SentryCrashIntegration to capture the stack trace when creating app hang events, if SentryCrashIntegration is disabled, the integration won’t work.

Since 8.0.0, this feature has been enabled by default. To disable it:

Copied
import Sentry

SentrySDK.start { options in
    options.dsn = "https://examplePublicKey@o0.ingest.sentry.io/0"
    options.enableAppHangTracking = false
}

If you want to change the timeout, you can do so by changing the appHangTimeoutInterval option:

Copied
import Sentry

SentrySDK.start { options in
    options.dsn = "https://examplePublicKey@o0.ingest.sentry.io/0"
    options.appHangTimeoutInterval = 1
}
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) to suggesting an update ("yeah, this would be better").