How to Implement Sending a Crash Event to Leanplum
The Crittercism SDK will create a notification that fires when the SDK knows that a crash occurred. On iOS, when the user loads the app after a crash occurred, this notification will fire. The notification will contain three pieces of information (we may add more later):
- Crash Name: The name of the crash (i.e., NSRangeException)
- Crash Reason: More details on why the crash occurred (i.e., "*** -[__NSArrayM objectAtIndex:]: index 18446744073709551615 beyond bounds for empty array")
- Crash Date: The date and time at which the crash occurred
To send these crash events to Leanplum, add two lines of code:
1. Register an Observer
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(crashDidOccur:) name:@"CRCrashNotification" object:nil];
2. Send an Event Upon Notification
- (void) crashDidOccur:(NSNotification*)notification { NSDictionary *crashInfo = notification.userInfo; NSString *crashName = crashInfo[@"crashName"]]; NSString *crashReason = crashInfo[@"crashReason"]; NSDate *crashDate = crashInfo[@"crashDate"]; // Leanplum [Leanplum track:@"ApteligentCrashEvent" withParameters:crashInfo]; }
Use Case Examples
With crashes recorded as Apteligent events, mutual customers can be used to:
- create audiences of app users to engage through in-app and push messages -- eg, to apologize, let them know a fix is on the way.
- detect is app is having an outage - don't send push notification.