HomeDocumentationAPI Reference
Getting StartedAPI ReferenceHelp CenterVideo Tours

Reporting Crashes

Covered here are APIs relevant to crash reporting.

🚧

Privacy Policy

It is highly recommended to mention in your privacy policy that you may be collecting logging data in order to assist with troubleshooting crashes.

There are two ways to have your application report a crash; either automatically or manually. After the crash is sent to your dashboard, you can easily sort and filter for specific crashes.

Automatic Crash Reporting

If you enable Crash Reporting, crashes will automatically be reported to and viewable from the crashes page of your Instabug dashboard.

You'll also see the trends covering the previous 7 days for the percentage of crash-free sessions (sessions that ran and concluded without any fatal errors), the total number of crashing sessions, the total number of sessions, and the total number of unique affected users. You can also see the total number of occurrences, the total number of fatal sessions, the total number of OOMs, and the total number of non-fatal errors. If there is a sharp decline in the crash-free sessions rate, an email will be sent to notify you.

21602160

This is the crashes page of the Instabug dashboard.

πŸ“˜

C++ Crashes

The Instabug SDK also supports and captures C++ crashes.

Out of Memory Crashes

By default, if Crash Reporting is enabled, Instabug captures OOM crashes, however, the crashes will not contain a stack trace and will only be captured if they happen while the app is in the foreground.

You can disable/enable capturing OOM crashes using the following API:

CrashReporting.OOMEnabled = false
IBGCrashReporting.OOMEnabled = NO

User Terminations

Starting from SDK version 11.1.0, Instabug automatically reports User Terminations. A User Termination is when a user force terminates your application and re-launches it within 10 seconds, which could indicate performance issues.

Please note that User Termination reports will not contain a stack trace.

App Hangs

Starting SDK version 10.13.0, Instabug automatically reports App Hangs. An App Hang is captured when the main thread is blocked for more than 3 seconds. App Hangs that last more than 2 seconds are considered severe and are likely to cause user frustration. They are reported along with a stack trace for debugging.

🚧

Warning

Crash reporting will not function correctly if the device is connected to Xcode. When it is, Xcode catches all exceptions and they will not be sent to your dashboard.

Manual Crash Reporting

You can use the following method and API to manually report any error or exception that you handle in your code and assign it a severity level.

Report Exception

To report exceptions manually, use the following method:

CrashReporting.report(exception)
[IBGCrashReporting reportException:exception];

Adding Level to Exception

You can set different levels for manually reported exceptions using the following API:

let exception = NSException(name: NSExceptionName("some_exception"), reason: "Exception reason")
if let nonFatalException = CrashReporting.exception(exception) {
    nonFatalException.userAttributes = [
      "hello" : "world"
    ]
    nonFatalException.groupingString = "com.service.method.some_exception"
    nonFatalException.level = .critical
    nonFatalException.report()
}
NSException *exception = [NSException exceptionWithName:@"some_exception" reason:@"Exception reason" userInfo:nil];
IBGNonFatalException *nonFatalException = [IBGCrashReporting exception:exception];
nonFatalException.userAttributes = @{
    @"hello" : @"world"
};
nonFatalException.groupingString = @"com.service.method.some_exception";
nonFatalException.level = IBGNonFatalLevelWarning;
[nonFatalException report];

Here are the different severity levels available. In case no level is indicated, the default level would be error

warning
error
critical
info
IBGNonFatalLevelWarning
IBGNonFatalLevelError
IBGNonFatalLevelCritical
IBGNonFatalLevelInfo

Report Errors

To report errors manually, use the following method:

let error = NSError(domain: "domain", code: 500, userInfo: nil)
CrashReporting.reportError(error)
NSError *error = [[NSError alloc] initWithDomain:@"domain" code:500 userInfo:nil];
[IBGCrashReporting reportError:error];

Adding Level to Error

You can set different levels for manually reported exceptions using the following API:

let error = NSError(domain: "com.service.method", code: 404)
if let nonFatalError = CrashReporting.error(error) {
    nonFatalError.userAttributes = [
      "hello" : "world"
    ]
    nonFatalError.groupingString = "com.service.method.404"
    nonFatalError.level = .critical
    nonFatalError.report()
}
NSError *error = [NSError errorWithDomain:@"com.service.method" code:404 userInfo:nil];
IBGNonFatalError *nonFatalError = [IBGCrashReporting error:error];
nonFatalError.userAttributes = @{
    @"hello" : @"world"
};
nonFatalError.groupingString = @"com.service.method.404";
nonFatalError.level = IBGNonFatalLevelWarning;
[nonFatalError report];

Here are the different severity levels available. In case no level is indicated, the default level would be error

warning
error
critical
info
IBGNonFatalLevelWarning
IBGNonFatalLevelError
IBGNonFatalLevelCritical
IBGNonFatalLevelInfo

Grouping

When an already existing crash occurs once more for any user, that crash is reported as an occurrence in the original entry. However, in order to calculate whether a crash already exists and needs to be grouped, Instabug generates a fingerprint based on attributes used in the grouping logic.

The default Instabug grouping algorithm uses a mix of the exception and stack trace information. In some cases, you might want to change how the issues are grouped together using custom fingerprints.

Custom Fingerprinting

🚧

Overriding the default grouping

Please note that using custom fingerprinting will override Instabug's default grouping by sending a fingerprint string.

In the event that you'd like to report the exception manually with a custom grouping fingerprint in mind, you can use the below APIs to do just that.

CrashReporting.reportError(error, withGroupingString: "grouping string")
CrashReporting.report(exception, withGroupingString: "grouping string")
[IBGCrashReporting reportException:exception groupingString:@"grouping string"];
[IBGCrashReporting reportError:error groupingString:@"grouping string"];

Crashes List

This section contains a list of all the crashes that have been reported by your application. The title of each crash is usually the most significant line in the stack trace.

21602160

An example of the list of crashes in the crashes page of the Instabug dashboard.

Next to each crash in the list, you can find the following details, all of which can be used to sort the crashes:

  • Occurrences: The number of times this crash has occurred and a bar graph representing its occurrences over the past seven days.
  • Users: The number of users affected by this crash.
  • Min ver.: The oldest app version that was affected by this crash.
  • Max ver.: The latest app version that was affected by this crash.
  • Last seen: The last time an occurrence of this crash was reported.

You can then filter for crashes that match any of the following criteria:

  • App version
  • Date
  • Device
  • OS
  • User attributes
  • Type
  • Status
  • Assignee
  • Team
  • Tags
  • Current view
  • Experiments

What’s Next

Learn more about the content contained in crash reports as well as how to symbolicate them. You can also use event handlers to collect additional information.