Application-Not-Responding(ANR)検出の構成

デフォルトでは、iOS エージェントは ANR 問題を検出しません。また、ANR 検出が有効になっている場合、ANR 問題はスタックトレースなしで報告されます。手動で ANR 検出を有効にし、iOS エージェント構成を使用してスタックトレースを含めるようにフラグを設定する必要があります。ANR モニタリングの詳細については、「コードの問題」を参照してください。ANR の問題のしきい値を指定するには、「アプリケーションが応答しないしきい値の設定」を参照してください。

ANR 検出の有効化

次に示すように、anrDetectionEnabled プロパティを使用してインストルメンテーションを構成することによって、ANR の問題の検出を有効にします。
Objective-C
 ADEumAgentConfiguration *adeumAgentConfig = [[ADEumAgentConfiguration alloc] initWithAppKey: <#EUM_APP_KEY#>];
// Enable ANR detection
adeumAgentConfig.anrDetectionEnabled  = YES;
[ADEumInstrumentation initWithConfiguration:adeumAgentConfig];
Swift
let config = ADEumAgentConfiguration(appKey: <#EUM_APP_KEY#>);
// Enable ANR detection
config.anrDetectionEnabled = true;
ADEumInstrumentation.initWith(config); 

ANR を使用したスタックトレースのレポート

ANR 検出を有効にすることに加えて、プロパティ anrStackTraceEnabled を [はい(Yes)](Objective-C)または [true](Swift)に設定して、ANR でスタックトレースを報告します。
Objective-C
 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
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)