Welcome to Instabug's Documentation!
Here you'll find a comprehensive technical guide
to help you start working with the Instabug SDK efficiently.

Get Started

Event Handlers

Covered here is how to set up the event handlers that fire before every crash report is sent so that a specific block of code is executed.

Before Sending a Report

This block is executed in the background before sending each report. You can use it to attach logs and extra data to reports.

Instabug.willSendReportHandler = { report in
    report.appendTag("tag1")
    report.logVerbose("Verbose log.")
    report.append(toConsoleLogs: "Console log statement.")
    report.setUserAttribute("value", withKey: "key")
    report.addFileAttachment(with: data)
    
    return report
}
Instabug.willSendReportHandler = ^IBGReport * _Nonnull(IBGReport * _Nonnull report) {
    [report appendTag:@"tag1"];
    [report logVerbose:@"Verbose log."];
    [report appendToConsoleLogs:@"Console log statement"];
    [report setUserAttribute:@"value" withKey:@"key"];

    return report;
};

Updated 12 months ago


What's Next

You can also set custom data, such as user attributes, inside event handlers. Logging user events in event handlers is possible as well.

Setting Custom Data
Report Logs

Event Handlers


Covered here is how to set up the event handlers that fire before every crash report is sent so that a specific block of code is executed.

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.