Crash tracking allows you to analyze crashes and exceptions in your mobile application.

Parameters

As soon as crash tracking is enabled, parameters are sent automatically to Mapp Intelligence. However, if you want to properly analyze them you'll need to configure the parameters in your account

ParameterDescriptionWhere to configure (Mapp Q3 > Configuration > ...)Where to analyze
Crash - Type

Type of crash:

  • 1: Uncaught
  • 2: Caught
  • 3: Custom
Categories > Custom Parameters > Event Parameter
metric
Crash - NameName of the crash. Name as given by the system or custom name in case custom type is used.Categories > Custom Parameters > Event Parameter

Navigation > Event Parameter > [Name of Parameter]

Crash - MessageCrash message. Message as given by the system or custom message in case custom type is used.
Crash - Cause MessageThe parsed string of the crash messages.
Crash - StackStack where the crash happened.
Crash - Cause StackStack that caused the crash.

Methods

Enable crash tracking in global configuration:

MethodDescriptionTracking OptionsDefault

.enableCrashTracking(exceptionLogLevel: exceptionType: exceptionType)

Enables crash tracking in global configuration. The following types can be tracked:

  • Uncaught exceptions
  • Caught exceptions
  • Caught exceptions with custom messages

The following configuration options are possible:

  • allExceptionTypes: All exceptions are tracked
  • noneOfExceptionTypes: No exceptions are tracked
  • caught: Only caught exceptions are tracked
  • uncaught: Only uncaught exceptions are tracked
  • custom: Only custom exceptions are tracked
  • custom_and_caught: Custom and caught exceptions are tracked
  • uncaught_and_caught: Uncaught and caught exceptions are tracked
  • uncaught_and_custom: Uncaught and custom exceptions are tracked

noneOfExceptionTypes

Example

  1. First, enable crash tracking in your global configuration settings:

    MappIntelligence.shared()?.initWithConfiguration([12345], onTrackdomain: "https://track.mapp.com")
    MappIntelligence.shared()?.enableCrashTracking(.allExceptionTypes)
    JAVA
  2. Then, you can track the desired exception in your application screens:

    @IBAction func trackExceptionWithNameAndMessage(_ sender: Any) {
            MappIntelligence.shared()?.trackException(withName: "Test Exception", andWithMessage: "Test Exception Message")
        }
        
    @IBAction func trackCaughtException(_ sender: Any) throws {
            //fatalError()
            NSException(name: NSExceptionName(rawValue: "Custom Exception"), reason: "Custom reason", userInfo: ["Localized key" : "Unexpected input"]).raise()
        }
        
    @IBAction func TrackError(_ sender: Any) {
            let userInfo: [String : Any] =
                        [
                            NSLocalizedDescriptionKey :  NSLocalizedString("Unauthorized", value: "Please activate your account", comment: "") ,
                            NSLocalizedFailureReasonErrorKey : NSLocalizedString("Unauthorized", value: "Account not activated", comment: "")
                    ]
            let error = NSError(domain: "ShiploopHttpResponseErrorDomain", code: 401, userInfo: userInfo)
            MappIntelligence.shared()?.trackException(with: error)
        }
    JAVA



Full Code Example

class ExceptionsViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
    }
    
    @IBAction func trackExceptionWithNameAndMessage(_ sender: Any) {
        MappIntelligence.shared()?.trackException(withName: "Test Exception", andWithMessage: "Test Exception Message")
    }
    
    @IBAction func trackUncaughtException(_ sender: Any) throws {
        //fatalError()
        NSException(name: NSExceptionName(rawValue: "Custom Exception"), reason: "Custom reason", userInfo: ["Localized key" : "Unexpected input"]).raise()
    }
    
    @IBAction func TrackError(_ sender: Any) {
        let userInfo: [String : Any] =
                    [
                        NSLocalizedDescriptionKey :  NSLocalizedString("Unauthorized", value: "Please activate your account", comment: "") ,
                        NSLocalizedFailureReasonErrorKey : NSLocalizedString("Unauthorized", value: "Account not activated", comment: "")
                ]
        let error = NSError(domain: "ShiploopHttpResponseErrorDomain", code: 401, userInfo: userInfo)
        MappIntelligence.shared()?.trackException(with: error)
    }

}
JAVA
  1. First, enable crash tracking in your global configuration settings:

    [[MappIntelligence shared] initWithConfiguration:@[@12345] onTrackdomain:@"www.track.mapp.com"];
    [[MappIntelligence shared] enableCrashTracking:allExceptionTypes];
    JAVA
  2. Then, you can track the desired exception in your application screens:

    - (void)trackExceptionWithNameAndMessage {
        [[MappIntelligence shared] trackExceptionWithName:@"Test Exception" andWithMessage:@"Test Exception Message"];
    }
    
    - (void)trackCaughtException {
        [[[NSException alloc] initWithName:@"Custom exception" reason:@"Custom reason" userInfo:@{@"Localized key" : @"Unexpected input"}] raise];
    }
    
    - (void)TrackError {
        
        NSDictionary* userInfo = @{
            NSLocalizedDescriptionKey :  NSLocalizedString(@"Unauthorized", @"Please activate your account") ,
            NSLocalizedFailureReasonErrorKey : NSLocalizedString(@"Unauthorized", @"Account not activated")
        };
        NSError* error = [[NSError alloc] initWithDomain:@"ShiploopHttpResponseErrorDomain" code:401 userInfo:userInfo];
        [[MappIntelligence shared] trackExceptionWith:error];
    }
    JAVA



Full Code Example

#import "ExceptionsViewController.h"
#import <MappIntelligence/MappIntelligence.h>

@interface ExceptionsViewController ()

@end

@implementation ExceptionsViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

- (void)trackExceptionWithNameAndMessage {
    [[MappIntelligence shared] trackExceptionWithName:@"Test Exception" andWithMessage:@"Test Exception Message"];
}

- (void)trackCaughtException {
    [[[NSException alloc] initWithName:@"Custom exception" reason:@"Custom reason" userInfo:@{@"Localized key" : @"Unexpected input"}] raise];
}

- (void)TrackError {
    
    NSDictionary* userInfo = @{
        NSLocalizedDescriptionKey :  NSLocalizedString(@"Unauthorized", @"Please activate your account") ,
        NSLocalizedFailureReasonErrorKey : NSLocalizedString(@"Unauthorized", @"Account not activated")
    };
    NSError* error = [[NSError alloc] initWithDomain:@"ShiploopHttpResponseErrorDomain" code:401 userInfo:userInfo];
    [[MappIntelligence shared] trackExceptionWith:error];
}


@end
JAVA