Customizing error reports

In order to quickly reproduce and fix errors, it is often helpful to send additional application-specific diagnostic data to Bugsnag.

Adding custom diagnostics

“Tabs” are additional groups of debugging information which can be added to error reports.

If you want to add a tab to your Bugsnag error report, you can call the addToTab method:

[Bugsnag addAttribute:@"favorite-tea" withValue:@"chamomile" toTabWithName:@"user"];
[Bugsnag addAttribute:@"registered-user" withValue:@"yes" toTabWithName:@"user"];

This will add a user tab to any error report sent to that contains the username and whether the user was registered or not.

Removing values from tabs

You can clear a single attribute on a tab by calling:

[Bugsnag addAttribute:@"dessert" withValue:nil toTabWithName:@"food"];

Clearing an entire tab

You can clear the contents of an entire tab using:

[Bugsnag clearTabWithName:@"user"];

Adding detailed breadcrumbs

A breadcrumb is a notable event leading up to a crash.

By default, Bugsnag captures common events including:

  • Low memory warnings
  • Device rotation
  • Menu presentation
  • Screenshots
  • Undo and redo
  • Table view selection
  • Window visibility changes
  • Non-fatal errors

Customizing individual breadcrumbs

You can add additional breadcrumbs with information about the app environment by calling leaveBreadcrumbWithBlock. Some common types of events captured include network requests, user authentication, presenting views modally, and button presses:

[Bugsnag leaveBreadcrumbWithBlock:^(BugsnagBreadcrumb *crumb) { = @"Popup Menu Visible";
    crumb.type = BSGBreadcrumbTypeNavigation;
    crumb.metadata = @{
        @"title": @"Select an example type"

Individual breadcrumb size is limited to 4kb after serialization. Any larger breadcrumbs will be dropped from the payload while logging a warning.

Capturing NSNotification events

To add breadcrumbs for every instance of a NSNotification being sent, use leaveBreadcrumbForNotificationName:

[Bugsnag leaveBreadcrumbForNotificationName:@"XYZControllerPushed"];

This can be useful for instrumenting your own notification pipelines for notable events more quickly.