Last Crash Notification


Listen to this notification to get crash data from the previous session. The notification userInfo contains some useful information related to the crash.

The following example shows how you can register to receive crash notifications.

NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
NSOperationQueue *mainQueue = [NSOperationQueue mainQueue]; = [center addObserverForName:CrittercismDidCrashOnLastLoadNotification
                                usingBlock:^(NSNotification *notification) {

        NSString *crashName = notification.userInfo[CrittercismCrashName];
        NSString *crashReason = notification.userInfo[CrittercismCrashReason];
        NSDate *crashDate = notification.userInfo[CrittercismCrashDate];
        NSArray *crashViews = notification.userInfo[CrittercismCrashView];
        // ...
// Swift 2.X
let center = NSNotificationCenter.defaultCenter()
let mainQueue = NSOperationQueue.mainQueue()
self.localeChangeObserver = center.addObserverForName(NSCurrentLocaleDidChangeNotification,
                                              object: nil,
                                               queue: mainQueue) { (notification) in

   let crashName = notification.userInfo[CrittercismCrashName];
   let crashReason = notification.userInfo[CrittercismCrashReason];
   let crashDate = notification.userInfo[CrittercismCrashDate];
   let crashViews = notification.userInfo[CrittercismCrashView];
   // ...

// Swift 3.x
let center = NotificationCenter.default
let mainQueue = OperationQueue.main
let localChangeObserver = center.addObserver(forName: NSLocale.currentLocaleDidChangeNotification,
                                            object: nil,
                                            queue: mainQueue) { (notification) in

    let crashName = notification.userInfo?[CrittercismCrashName];
    let crashReason = notification.userInfo?[CrittercismCrashReason];
    let crashDate = notification.userInfo?[CrittercismCrashDate];
    let crashViews = notification.userInfo?[CrittercismCrashView];
    // ...
NSString * const CrittercismDidCrashOnLastLoadNotification
// Swift 2.x and 3.x

let CrittercismDidCrashOnLastLoadNotification: String
Last Crash UserInfo Keys
The CrittercismDidCrashOnLastLoadNotification userInfo contains the crash name, reason, date, and an array of crashed view controller names.
CrittercismCrashName Returns an NSString that describes the crash name
CrittercismCrashReason Returns an NSString that describes the crash reason
CrittercismCrashDate Returns an NSString that informs the time of crash
CrittercismCrashView Returns an NSArray of crashed view controller names


By default, Apteligent prints a few messages (via NSLog) to the device log that may be useful to verify that Apteligent is initialized and properly working. If you don’t want to see Apteligent log messages, you can tune the amount of logging that is displayed.

See Setting Apteligent’s Log Verbosity of how to tweak the logging level

typedef enum : NSInteger {
} CRLoggingLevel;
// Swift 2.X and 3.x

enum CRLoggingLevel : Int {
    case Silent
    case Error
    case Warning
    case Info
    case Debug
CRLoggingLevelSilent Turns off all Apteligent log messages
CRLoggingLevelError Only print errors. An error is an unexpected event that will result not capturing important data
CRLoggingLevelWarning (Default) Only print warnings. Currently warning messages are printed when calling Apteligent methods before initializing Apteligent
CRLoggingLevelInfo The most verbose level of logging
CRLoggingLevelDebug Print internal logging in Apteligent. Please use this logging level and attach your log in your email to