Contents

DiagnosticResult

An enumeration that represents a single diagnostic event from a diagnostic report.

Declaration

enum DiagnosticResult

Mentioned in

Discussion

DiagnosticResult unifies all diagnostic event types into a single enum. Each associated value is a typed diagnostic struct that carries a CallStackTree and additional event-specific properties such as hang duration, total CPU time, or launch duration.

Access the result through result after iterating over diagnosticReports. Switch over the result to handle each diagnostic type:

for await report in manager.diagnosticReports {
    switch report.result {
    case .crash(let diagnostic):
        handleCrash(diagnostic)
    case .hang(let diagnostic):
        handleHang(diagnostic)
    case .cpuException(let diagnostic):
        handleCPUException(diagnostic)
    case .diskWriteException(let diagnostic):
        handleDiskWriteException(diagnostic)
    case .appLaunch(let diagnostic):
        handleAppLaunchDiagnostic(diagnostic)
    @unknown default:
        break
    }
}

This type replaces the crashDiagnostics, hangDiagnostics, cpuExceptionDiagnostics, diskWriteExceptionDiagnostics, and appLaunchDiagnostics properties of MXDiagnosticPayload.

Topics

Call stack

Diagnostic results

Enumeration Cases

See Also

Result types