Skip to main content

Privacy and report fields

note

Looking for the previous SDK? See the 6.x report privacy page.

A report carries fields the user typed or your code set — summary, description, email, labels — plus attributes and attachments. Before a report is uploaded you can inspect all of it and strip what must not leave the device. Two mechanisms do this:

  • The report handler sees every report, whatever filed it: the report dialog, upload…, logError, logException, a crash recovered on the next launch. It can change every field, attribute, label and attachment.
  • The report-fields delegate methods see only reports filed from the built-in report dialog, and only their summary, description, severity and labels. Use them to pre-fill the dialog or to post-process what the user typed.

Report handler​

Set an object that conforms to BugseeReportHandler with setReportHandler:. Each callback receives the report itself, as a BugseeReport: whatever you change on it is what gets uploaded. Set the handler before launchWithToken:, so that it also sees the crashes recovered at launch.

@interface PrivacyReportHandler : NSObject <BugseeReportHandler>
@end

@implementation PrivacyReportHandler

- (void)onAfterReportCreated:(BugseeReport *)report
isTerminating:(BOOL)isTerminating
completion:(BugseeEmptyBlock)completion {
// Strip what the user may have typed into the dialog
// (-redact: stands for your own redaction code)
report.email = nil;
report.reportDescription = [self redact:report.reportDescription];

// Remove an attribute that must not leave the device
[report removeAttribute:@"session_token"];

// No attachments at all: clear them, and return none from the delegate
[report clearAttachments];

completion();
}

@end

// Before launch
[Bugsee setReportHandler:[PrivacyReportHandler new]];
[Bugsee launchWithToken:@"<your_app_token>"];

What you can change on the report:

MemberNotes
summary, reportDescription, emailSet to nil to clear.
severityBugseeSeverityLow to BugseeSeverityBlocker; any other value is ignored.
labels, addLabel:, addLabels:, clearLabelsAssigning labels replaces the whole set.
attributes, getAttribute:, setAttribute:withValue:, removeAttribute:, clearAllAttributesThe report's own attributes. A nil value removes the attribute.
attachments, addAttachment:, clearAttachmentsclearAttachments also removes attachments set on a BugseeExtendedReport. Attachments your delegate returns afterwards are still added.

Call completion once, when you are done; changes made after it are ignored. A callback may be called again for a report recovered after a crash, so make a second run harmless. The callbacks, their threads and their time limits are described in Report handler.

note

Attributes set with +[Bugsee setAttribute:withValue:] and the user identifier persist across launches and go into every report. Removing an attribute from one report does not clear it; use clearAttribute: or clearUserIdentifier for that. See User & session data.

Report-fields delegate methods​

These BugseeDelegate methods apply to reports filed from the built-in report dialog. Each comes in a synchronous and an asynchronous form; if you implement both, the synchronous one is used.

  • Before the dialog opens, bugseeAddFieldsBeforeReportCreated (Swift bugseePrepareReportFields()) or its asynchronous form returns the fields to pre-fill. The user can still edit them.
  • After the user sends the report, bugseeCheckFieldsAfterReportCreated: (Swift bugsee(finalizeReportFields:)) or its asynchronous form receives what the user entered and returns the fields to upload. The dialog closes once you answer.
- (void)bugseeAddFieldsBeforeReportCreatedWith:(void (^)(BugseeReportFields *))completion {
completion([BugseeReportFields reportFieldsWith:@"Checkout issue"
description:@""
severity:BugseeSeverityHigh
labels:@[@"checkout"]]);
}

- (void)bugseeCheckFieldsAfterReportCreated:(BugseeReportFields *)report
completionHandler:(void (^)(BugseeReportFields *))completion {
report.summary = [self redact:report.summary];
report.reportDescription = [self redact:report.reportDescription];
completion(report);
}

// ...somewhere within the class
[Bugsee sharedInstance].delegate = self;

The synchronous forms are bugseeAddFieldsBeforeReportCreated / bugseePrepareReportFields(), which returns a BugseeReportFields, and bugseeCheckFieldsAfterReportCreated: / bugsee(finalizeReportFields:), which returns the changed fields.

On a dialog report the order is: the report handler's onBeforeReportCreated, then the pre-fill method, which replaces the summary, description and labels it set (and the severity, when it returns one from 1 to 5), and the user's edits; then, once the user sends the report, onAfterReportCreated, then the finalize method.

Found an issue, typo, or wrong statement on this page? Report it now →