Skip to content

Introduces the missing Crash Dialog for Microsoft's AppCenter.

License

Notifications You must be signed in to change notification settings

Iomegan/CrashReporterAC

Repository files navigation

CrashReporterAC

Version License Platform

Description

A bug report contains device logs, stack traces, and other diagnostic information to help you find and fix bugs in your app. It should also include user feedback that helps you to reproduce the issue. Unfortunately that's not part of Microsoft' AppCenter implementation for macOS. However there are APIs that allow you to send text attachments with each crash. CrashReporterAC asks the user for feedback and submits it with the crash details to AppCenter.

Screenshot

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

CrashReporterAC is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'CrashReporterAC'

Add this to your AppDelegate:

private let crashReporterAC = CrashReporterAC(helpURL: URL(string: "https://example.com/privacy/#app-center"))

Make sure to add the following before calling AppCenter.start(), usually in applicationDidFinishLaunching(_:):

Crashes.delegate = self //Call this before AppCenter.start(...)
let crashReporterAC = CrashReporterAC(helpURL: URL(string: "https://example.com/privacy/#app-center"))
Crashes.userConfirmationHandler = crashReporterAC.userConfirmationHandler

Also implement the delegates:

// MARK: - CrashesDelegate
    
func attachments(with crashes: Crashes, for errorReport: ErrorReport) -> [ErrorAttachmentLog] {
    guard crashReporterAC.crashUserProvidedDescription != nil else {
        return []
    }

    let attachment1 = ErrorAttachmentLog.attachment(withText: crashReporterAC.crashUserProvidedDescription!, filename: "UserProvidedDescription.txt")
    return [attachment1! 
}
    
func crashes(_ crashes: Crashes, didFailSending errorReport: ErrorReport, withError error: Error) {
    crashReporterAC.crashUserProvidedDescription = nil
}
    
func crashes(_ crashes: Crashes, didSucceedSending errorReport: ErrorReport) {
    crashReporterAC.crashUserProvidedDescription = nil
}

Author

Daniel Witt, [email protected]

Localization

  • Massimiliano Picchi (Italian)
  • Ange Lefrère (French)
  • Daniel Witt (German)

License

CrashReporterAC is available under the MIT license. See the LICENSE file for more info.

About

Introduces the missing Crash Dialog for Microsoft's AppCenter.

Resources

License

Stars

Watchers

Forks

Packages

No packages published