Skip to content

Commit ccaabf1

Browse files
brustolinimatwawanabruno-garcia
authored
Feat(apple): App hang documentation (#5267)
Co-authored-by: Isabel <76437239+imatwawana@users.noreply.github.com> Co-authored-by: Bruno Garcia <bruno@brunogarcia.com>
1 parent 16d0fef commit ccaabf1

File tree

3 files changed

+57
-1
lines changed

3 files changed

+57
-1
lines changed

src/includes/getting-started-primer/apple.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
- C++ exceptions
1010
- Objective-C exceptions
1111
- Error messages of fatalError, assert, and precondition
12-
- App Hang Detection
12+
- [App Hang Detection](/platforms/apple/configuration/app-hangs/)
1313
- [Out of memory](/platforms/apple/configuration/out-of-memory/)
1414
- Events [enriched](/platforms/apple/enriching-events/context/) with device data
1515
- Offline caching when a device is unable to connect; we send a report once we receive another event
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
title: App Hangs
3+
sidebar_order: 11
4+
description: "Learn about how to add app hang detection reporting."
5+
---
6+
7+
This integration tracks app hangs. This feature is available on iOS, tvOS, macOS, and watchOS.
8+
9+
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.
10+
With app hang tracking, you can detect and fix this problem.
11+
12+
The app hang detection integration has a default timeout of two (2) seconds, which means if the app becomes unresponsive for two seconds, an error event is created.
13+
The event has the stack trace of all running threads so you can easily detect where the problem occurred.
14+
15+
To use this feature, add this to your code:
16+
17+
```swift {tabTitle:Swift}
18+
import Sentry
19+
20+
SentrySDK.start { options in
21+
options.dsn = "___PUBLIC_DSN___"
22+
options.enableAppHangTracking = true
23+
}
24+
```
25+
26+
```objc {tabTitle:Objective-C}
27+
@import Sentry;
28+
29+
[SentrySDK startWithConfigureOptions:^(SentryOptions *options) {
30+
options.dsn = @"___PUBLIC_DSN___";
31+
options.enableAppHangTracking = YES;
32+
}];
33+
34+
```
35+
36+
If you want to change the timeout, you can do so by changing the `appHangTimeoutInterval` option:
37+
38+
```swift {tabTitle:Swift}
39+
import Sentry
40+
41+
SentrySDK.start { options in
42+
options.dsn = "___PUBLIC_DSN___"
43+
options.appHangTimeoutInterval = 1
44+
}
45+
```
46+
47+
```objc {tabTitle:Objective-C}
48+
@import Sentry;
49+
50+
[SentrySDK startWithConfigureOptions:^(SentryOptions *options) {
51+
options.dsn = @"___PUBLIC_DSN___";
52+
options.appHangTimeoutInterval = 1;
53+
}];
54+
55+
```

src/wizard/apple/ios.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,5 +108,6 @@ SentrySDK.start { options in
108108
options.enableFileIOTracking = true
109109
options.enableCoreDataTracking = true
110110
options.enableUserInteractionTracing = true
111+
options.enableAppHangTracking = true
111112
}
112113
```

0 commit comments

Comments
 (0)