AardvarkCrashReport is an extension to Aardvark that makes it easy to provide high quality data about crashes in your bug reports.
To install AardvarkCrashReport via CocoaPods, simply add the following line to your Podfile:
pod 'AardvarkCrashReport'
AardvarkCrashReport is built on top of PLCrashReporter. If you don't already have PLCrashReporter set up in your app, it's easy to get started. When your app launches, simply create and store a PLCrashReporter
, then enable it to begin monitoring for crashes.
self.crashReporter = PLCrashReporter(configuration: .defaultConfiguration())
try? self.crashReporter?.enableAndReturnError()
AardvarkCrashReport provides two ways to gather data from the crash reporter: one for crashes that happened on the prior app launch and one to collect a "live" report (a description of the current state of the app).
When your interface loads, call the CrashReportAttachmentGenerator
's attachmentForPendingCrashReport(from:)
method to check if there is a crash report from the prior launch. If there is, the method will return a bug report attachment containing the crash report. If not, it will return nil
.
if let attachment = CrashReportAttachmentGenerator.attachmentForPendingCrashReport(from: crashReporter) {
// Show a bug report prompt with the `attachment` included.
}
Check out the AppDelegate
in the demo app for an example of how to show a bug report prompt.
To generate an attachment containing a live report, call the CrashReportAttachmentGenerator
's attachmentForLiveReport(from:)
method.
let attachment = CrashReportAttachmentGenerator.attachmentForLiveReport(from: crashReporter)
Check out the LiveBugReporterAttachmentDelegate
for an example of how this can be used in an attachment delegate for an ARKEmailBugReporter.
AardvarkCrashReport include a demo app that shows how the framework can be used. To run the demo app:
- Clone the repo.
- Open the
Example
directory. - Run
bundle exec pod install
. - Open
AardvarkCrashReportDemo.xcworkspace
. - Enable code signing for the
AardvarkCrashReportDemo
to use your development team. - Run the
AardvarkCrashReportDemo
scheme on your device.
Note that the demo app uses an email-based bug reporter, so it will not be able to file the report from a simulator since the simulator does not include the Mail app. The crash reporter is also automatically disabled when the debugger is attached, so to test the flow you will need to run the app on your device without attaching a debugger.
- Xcode 14.0 or later
- iOS 14.0 or later
We’re glad you’re interested in AardvarkCrashReport, and we’d love to see where you take it. Please read our contributing guidelines prior to submitting a Pull Request.
Copyright 2024 Block, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.