Bug report attachments
A bug-report attachment adds one application-specific file to the report shown in the Appelium Dashboard. Use it for diagnostic state that is not already covered by screenshots, the activity log or network logs, such as a compact database export, generated diagnostic JSON or a relevant local cache file.
The delegate is evaluated when the user or application invokes bug reporting. Returning nil omits the attachment for that report.
Configure the delegate
Conform an existing long-lived object—commonly the app delegate—to BugReportingDelegate and pass it to the bug-reporting configuration:
AppeliumFeedback.start(
apiKey: "YOUR_APP_TOKEN",
bugReporting: .enabled(delegate: self)
)
extension AppDelegate: BugReportingDelegate {
func bugReportAttachment() -> ReportAttachment? {
guard let data = loadDiagnosticSnapshot() else {
return nil
}
return ReportAttachment(
fileName: "diagnostics.json",
data: data
)
}
}
Call the configuration only after the SDK and application environment are ready. Prefer a method that reads or creates the attachment quickly; the delegate runs as part of report creation.
Attachment limits
Each ReportAttachment contains a file name and raw Data. The SDK keeps the last 100,000 bytes if the supplied data is larger. The current bug-reporting API supports one delegate attachment in addition to the standard screenshot, console/network activity and recording data.
Prefer small, self-describing content:
- use a meaningful extension such as
.json,.txtor.sqlite; - omit large logs or database contents already represented by other report types;
- truncate collections before serialising rather than relying on the SDK to retain the final bytes;
- if the data cannot be produced safely, return
nilrather than attaching a stale file.
Loading a file safely
Avoid force-unwrapping file contents. For example:
func bugReportAttachment() -> ReportAttachment? {
do {
let snapshotUrl = try documentDirectory().appending(
path: "diagnostics/state.json"
)
let data = try Data(contentsOf: snapshotUrl)
return ReportAttachment(fileName: "state.json", data: data)
} catch {
AppeliumFeedback.logWarning(
"Unable to prepare the bug report attachment",
domain: "Diagnostics"
)
return nil
}
}
The method can also build the payload in memory from the current state instead of exposing an internal storage file.
Privacy
Attachments are uploaded with the bug report. Review their schema as carefully as the report itself:
- do not attach passwords, access or refresh tokens, private keys, payment-card data or full user profiles;
- use IDs and state transitions when raw names or email addresses are unnecessary;
- avoid complete SQLite databases unless the retention and field-level contents are explicitly approved;
- account for attachment data in the application privacy policy and the workspace retention setting.
See Initialization for the privacy-on-by-default feature model and Network Logs for request and response redaction.
Troubleshooting
- No attachment in the Dashboard: confirm the delegate is the same object passed to
.enabled(delegate:)and thatbugReportAttachment()returned non-nil. - The file contains only its end: the source exceeded 100,000 bytes; reduce or summarise it before creating
ReportAttachment. - A report cannot be prepared: make file access bounded and non-interactive. Return
nilwhen the snapshot cannot be generated safely. - Sensitive data appears in reports: stop attaching it, rotate any exposed credential, and review the workspace's data-retention and privacy requirements.