Bug Reporting

This page covers some APIs specific for iOS bug reporting.

We're covering bug reporting in this page. However, in the Reports Data section, you can find more information about the information and data sent with each bug report.

Required Fields

Email Address

Bug reports and feedback by default require users to enter a valid email address. To allow users to send bug reports and feedback without an email, use the following method.

IBGBugReporting.invocationOptions = IBGBugReportingInvocationOptionEmailFieldOptional | IBGBugReportingInvocationOptionCommentFieldRequired;
BugReporting.invocationOptions = [.emailFieldOptional | .commentFieldRequired]

You can also remove the email field from the UI completely using the following API:

IBGBugReporting.invocationOptions = IBGBugReportingInvocationOptionEmailFieldHidden;
BugReporting.invocationOptions = [.emailFieldHidden]

Comment

By default, users could send bug reports and feedback without entering a comment. To require users to enter a comment before they are able to send a bug report or feedback, use the following method.

IBGBugReporting.invocationOptions =  IBGBugReportingInvocationOptionCommentFieldRequired;
BugReporting.invocationOptions = [.commentFieldRequired]

The image below shows the 1st view that your users will see while reporting a bug.

Bug Report View

Bug Report View

SDK Events

Before Showing the SDK

This block is executed on the UI thread. Could be used for performing any UI changes before the SDK's UI is shown.

IBGBugReporting.willInvokeHandler = ^{
    [someObject setSomeState];
};
BugReporting.willInvokeHandler = {
    someObject.setSomeState()
}

Before Sending a Report

This block is executed in the background before sending each report. Could be used for attaching logs and extra data to reports.

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;
};
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
}

After the SDK Has Been Dismissed

This block is executed on the UI thread. Could be used for performing any UI changes after the SDK's UI has been dismissed.

IBGBugReporting.didDismissHandler = ^(IBGDismissType dismissType, IBGReportType reportType) {
    [someObject setSomeState];
};
BugReporting.didDismissHandler = { (dismissType, reportType) in
    someObject.setSomeState()
}

The didDismissHandler block has the following parameters:

  • IBGDismissType: How the SDK was dismissed.
  • IBGReportType: Type of report that has been sent. Will be set to IBGReportTypeBug in case the SDK has been dismissed without selecting a report type, so you might need to check issueState before IBGReportType.

Disabling and Enabling

Bug reporting, feedback, and chats can be enabled or disabled separately. When the user invokes the SDK with any of the invocation events, a popup appears showing all the enabled features. When only a single option is enabled, it becomes the default invocation mode and the popup doesn't appear. If all options are disabled, bug reporting becomes the default invocation mode.

IBGBugReporting.promptOptions = IBGPromptOptionBug | IBGPromptOptionFeedback;
BugReporting.promptOptions = [.bug, .feedback]

By default, all three options are enabled if they are available in your current plan.