Configure Application-Not-Responding (ANR) Detection

By default, the iOS Agent does not detect ANR issues, and when ANR detection is enabled, the ANR issues are reported without stack traces. You must manually enable ANR detection and set a flag to include stack traces through the iOS Agent configuration. For more information about ANR monitoring, see Code Issues. To specify thresholds for ANR issues, see Configure Application Not Responding Thresholds.

Enable ANR Detection

You enable the detection of ANR issues by configuring the instrumentation with the anrDetectionEnabled property as shown below.
Objective-C
CODE
ADEumAgentConfiguration *adeumAgentConfig = [[ADEumAgentConfiguration alloc] initWithAppKey: <#EUM_APP_KEY#>];
// Enable ANR detection
adeumAgentConfig.anrDetectionEnabled  = YES;
[ADEumInstrumentation initWithConfiguration:adeumAgentConfig];
Swift
JAVASCRIPT
let config = ADEumAgentConfiguration(appKey: <#EUM_APP_KEY#>);
// Enable ANR detection
config.anrDetectionEnabled = true;
ADEumInstrumentation.initWith(config);

Report Stack Traces with ANRs

In addition to enabling ANR detection, you set the property anrStackTraceEnabled to YES (Objective-C) or true (Swift) to report stack traces with the ANRs.
Objective-C
CODE
ADEumAgentConfiguration *adeumAgentConfig = [[ADEumAgentConfiguration alloc] initWithAppKey: <#EUM_APP_KEY#>];
// Enable ANR detection
adeumAgentConfig.anrDetectionEnabled  = YES;
// Set the flag to include stack traces with ANRs
adeumAgentConfig.anrStackTraceEnabled  = YES;
[ADEumInstrumentation initWithConfiguration:adeumAgentConfig];
Swift
JAVASCRIPT
let config = ADEumAgentConfiguration(appKey: <#EUM_APP_KEY#>)
// Enable ANR detection
config.anrDetectionEnabled = true
// Set the flag to include stack traces with ANRs
config.anrStackTraceEnabled = true
ADEumInstrumentation.initWith(config)