Reliable, open-source crash reporting for iOS, macOS and tvOS
Перейти к файлу
Anastasia Kubova b16e6136e2 Update changelog 2021-06-10 10:28:55 +03:00
.azure-pipelines Add assembly Carthage artifacts 2021-06-09 08:15:07 +03:00
.github Add GitHub templates 2020-07-03 14:51:39 +03:00
CrashReporter.xcodeproj Merge branch 'master' into release/1.9.0 2021-06-09 13:09:45 +03:00
Dependencies Add CG manifest for protobuf-c 2020-04-28 11:09:27 +03:00
Documentation/Crash Log Format Rename to 'Crash Log Format' 2008-12-16 07:31:54 +00:00
Other Sources Fix macOS framework settings 2020-06-25 15:02:32 +03:00
Resources Fix macOS framework settings 2020-06-25 15:02:32 +03:00
Scripts Add assembly the Carthage artifacts to targets 2021-06-09 13:00:55 +03:00
Source Rename labels 2021-03-25 15:30:44 +03:00
Tests Fix unit test 2020-10-14 14:04:43 +03:00
Tools/CrashViewer Merge branch '1.2-with-master' into prepre-for-merge 2019-10-18 17:52:26 +03:00
include Add SPM support 2020-04-30 19:09:26 +03:00
.gitignore Update autogenerated files and ignore temp file that produced by doxygen 2020-04-29 20:15:36 +03:00
CHANGELOG.md Update changelog 2021-06-10 10:28:55 +03:00
Doxyfile update doxyfile, fix unbalanced grouping commands 2020-05-08 19:34:33 +04:00
LICENSE Add MS copyright 2020-03-06 10:12:59 -08:00
PLCrashReporter.podspec Bump version to 1.9.0 2021-06-08 13:21:16 +03:00
Package.swift Drop support of iOS 8. The minimal version is iOS 9 now 2020-10-09 16:59:44 +03:00
README.md Address feedback 2021-03-01 11:10:10 +03:00
ThirdPartyNotices.txt Remove "Catch" from 3rd party notices 2019-10-18 17:04:14 +03:00

README.md

CocoaPods Carthage compatible SwiftPM compatible

PLCrashReporter

PLCrashReporter is a reliable open source library that provides an in-process live crash reporting framework for use on iOS, macOS and tvOS. The library detects crashes and generates reports to help your investigation and troubleshooting with the information of application, system, process, thread, etc. as well as stack traces.

The easiest way to use PLCrashReporter is by using AppCenter. However, if you want to use PLCrashReporter directly, grab the latest release at releases page.

Features

  • Uses only supported and public APIs/ABIs for crash reporting.
  • The most accurate stack unwinding available, using DWARF and Apple Compact Unwind frame data.
  • First released in 2008, and used in hundreds of thousands of apps. PLCrashReporter has seen a tremendous amount of user testing.
  • Does not interfere with debugging in lldb/gdb
  • Easy to integrate with existing or custom crash reporting services.
  • Backtraces for all active threads are provided.
  • Provides full register state for the crashed thread.

Prerequisites

  • Xcode 11 or above.
  • Minimum supported platforms: iOS 9, macOS 10.9, tvOS 9, Mac Catalyst 13.0.

Decoding Crash Reports

Crash reports are output as protobuf-encoded messages, and may be decoded using the CrashReporter library or any Google Protocol Buffers decoder.

In addition to the in-library decoding support, you may use the included plcrashutil binary to convert crash reports to apple's standard iPhone text format. This may be passed to the symbolicate tool.

plcrashutil convert --format=iphone example_report.plcrash | symbolicatecrash Future library releases may include built-in re-usable formatters, for outputting alternative formats directly from the phone.

Usage

PLCrashReporter can be added to your app via CocoaPods, Carthage, Swift Package Manager, or by manually adding the binaries to your project.

Example

The following example shows a way how to initialize crash reporter. Please note that enabling in-process crash reporting will conflict with any attached debuggers.

@import CrashReporter;

...

// It is strongly recommended that local symbolication only be enabled for non-release builds.
// Use PLCrashReporterSymbolicationStrategyNone for release versions.
PLCrashReporterConfig *config = [[PLCrashReporterConfig alloc] initWithSignalHandlerType: PLCrashReporterSignalHandlerTypeMach
                                                                   symbolicationStrategy: PLCrashReporterSymbolicationStrategyAll];
PLCrashReporter *crashReporter = [[PLCrashReporter alloc] initWithConfiguration: config];

// Enable the Crash Reporter.
NSError *error;
if (![crashReporter enableCrashReporterAndReturnError: &error]) {
    NSLog(@"Warning: Could not enable crash reporter: %@", error);
}

Checking collected crash report can be done in the following way:

if ([crashReporter hasPendingCrashReport]) {
    NSError *error;

    // Try loading the crash report.
    NSData *data = [crashReporter loadPendingCrashReportDataAndReturnError: &error];
    if (data == nil) {
        NSLog(@"Failed to load crash report data: %@", error);
        return;
    }

    // Retrieving crash reporter data.
    PLCrashReport *report = [[PLCrashReport alloc] initWithData: data error: &error];
    if (report == nil) {
        NSLog(@"Failed to parse crash report: %@", error);
        return;
    }

    // We could send the report from here, but we'll just print out some debugging info instead.
    NSString *text = [PLCrashReportTextFormatter stringValueForCrashReport: report withTextFormat: PLCrashReportTextFormatiOS];
    NSLog(@"%@", text);

    // Purge the report.
    [crashReporter purgePendingCrashReport];
}

Building

Prerequisites

  • A Mac running macOS compliant with Xcode requirements.
  • Xcode 11 or above.

Also, next optional tools are used to build additional resources:

Building

  • Open a new window for your Terminal.

  • Go to PLCrashReporter's root folder and run

    xcodebuild -configuration Release -target 'CrashReporter'
    

    to create binaries for all platforms.

Contributing

We are looking forward to your contributions via pull requests.

To contribute to PLCrashReporter, you need the tools mentioned above to build PLCrashReporter for all architectures and protobuf-c to convert Protocol Buffer .proto files to C descriptor code.

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.