Crash Tracking

Prev Next

Crash tracking lets you analyze crashes and exceptions inside your iOS app. When enabled, the SDK automatically attaches crash parameters to event requests. To analyze them in Mapp Intelligence, the corresponding parameters must be configured in your account.

Tracked parameters

The following parameters are sent automatically once crash tracking is enabled. They must be configured as Event Parameters in your Mapp Intelligence account for analysis:

Parameter

Description

Where to analyze

Crash – Type

Type of crash:

  • 1: Uncaught

  • 2: Caught

  • 3: Custom

metric

Crash – Name

Name of the crash, either system-generated or custom (when custom type is used).

Navigation > Event Parameter

Crash – Message

Message associated with the crash, system or custom.

Crash – Cause Message

Parsed string from the crash message.

Crash – Stack

Stack where the crash happened.

Crash – Cause Stack

Stack that caused the crash.

Methods

Method

Description

Tracking Options

enableCrashTracking(_ exceptionLogLevel: exceptionType)

Enables crash tracking and selects which exception types are tracked.

  • .noneOfExceptionTypes — disables crash tracking (default)

  • .allExceptionTypes — tracks all types

  • .uncaught — uncaught only

  • .caught — caught only

  • .custom — custom only

  • .uncaught_and_caught

  • .uncaught_and_custom

  • .custom_and_caught

trackException(with: NSError)

Tracks a caught NSError as an event.

trackException(withName:andWithMessage:)

Tracks a custom exception with name and message.

Example

  1. Enable crash tracking in your global configuration:

    MappIntelligence.shared()?.initWithConfiguration(
        [123451234512345],
        onTrackdomain: "https://your-trackdomain.com"
    )
    MappIntelligence.shared()?.enableCrashTracking(.allExceptionTypes)
  2. Track caught and custom exceptions in your view controllers:

    // Custom exception with name and message
    MappIntelligence.shared()?.trackException(
        withName: "Test Exception",
        andWithMessage: "Test Exception Message"
    )
    
    // Caught NSError
    let userInfo: [String: Any] = [
        NSLocalizedDescriptionKey: "Unauthorized",
        NSLocalizedFailureReasonErrorKey: "Account not activated"
    ]
    let error = NSError(domain: "MyAppDomain", code: 401, userInfo: userInfo)
    MappIntelligence.shared()?.trackException(with: error)
  1. Enable crash tracking in your global configuration:

    [[MappIntelligence shared]
        initWithConfiguration:@[@123451234512345]
                onTrackdomain:@"https://your-trackdomain.com"];
    [[MappIntelligence shared] enableCrashTracking:allExceptionTypes];
  2. Track caught and custom exceptions:

    // Custom exception with name and message
    [[MappIntelligence shared]
        trackExceptionWithName:@"Test Exception"
                andWithMessage:@"Test Exception Message"];
    
    // Caught NSError
    NSDictionary *userInfo = @{
        NSLocalizedDescriptionKey: @"Unauthorized",
        NSLocalizedFailureReasonErrorKey: @"Account not activated"
    };
    NSError *error = [[NSError alloc] initWithDomain:@"MyAppDomain"
                                                code:401
                                            userInfo:userInfo];
    [[MappIntelligence shared] trackExceptionWith:error];

Uncaught exceptions are captured automatically once enableCrashTracking is set to a type that includes uncaught. You do not need to wrap your code in additional handlers for this case.

Related pages: Configure Global Tracking.