Skip to content

Commit

Permalink
Add example
Browse files Browse the repository at this point in the history
  • Loading branch information
bamx23 committed Jul 7, 2024
1 parent 1577de0 commit be1643f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Samples/Common/Sources/LibraryBridge/ReportingSample.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,18 @@ public class ReportingSample {
KSCrash.shared().sendAllReports { reports, isSuccess, error in
if isSuccess, let reports {
print("Logged \(reports.count) reports")
for (idx, report) in reports.enumerated() {
switch report {
case let stringReport as CrashReportString:
print("Report #\(idx) is a string (length is \(stringReport.value.count))")
case let dictionaryReport as CrashReportDictionary:
print("Report #\(idx) is a dictionary (number of keys is \(dictionaryReport.value.count))")
case let dataReport as CrashReportData:
print("Report #\(idx) is a binary data (size is \(dataReport.value.count) bytes)")
default:
print("Unknown report #\(idx): \(report.debugDescription ?? "?")")
}
}
} else {
print("Failed to log reports: \(error?.localizedDescription ?? "")")
}
Expand Down

0 comments on commit be1643f

Please sign in to comment.