Giter VIP home page Giter VIP logo

crashlyticsrecorder's Introduction

CrashlyticsRecorder

Version License Platform

The Crashlytics platform is unable to be included as a transitive dependency, meaning you are unable to use it in a framework that will be included in an application that uses Crashlytics. This library uses dependency injection to create a wrapper around the Crashlytics and Answers classes for use in other frameworks.

Functionality

  • Set custom keys on crash reports
  • Record non-fatal errors
  • Record Swift ErrorType errors with custom keys
  • Logging using CLS_LOG
  • Record events using Answers
  • Logging of custom exceptions

Usage

In Frameworks

CrashlyticsRecorder and AnswersRecorder act as wrappers for Crashlytics and Answers respectively. To use these classes, include this pod as a dependency for your framework. If you are using CocoaPods, this can be accomplished by adding the following lines to your Podfile and podspec.

Podfile

pod 'CrashlyticsRecorder'

podspec

s.dependency 'CrashlyticsRecorder'

You can then use CrashlyticsRecorder.sharedInstance and AnswersRecorder.sharedInstance in your framework.

In Applications

In order for CrashlyticsRecorder to work properly in your application's included frameworks, you will need to take a few steps.

  1. Include the CrashlyticsAdapter.swift file in your application target. Alternatively, you can copy the following code into your AppDelegate, or anywhere in your application target.
import Crashlytics
import CrashlyticsRecorder

extension Crashlytics: CrashlyticsProtocol {
    public func log(format: String, args: CVaListPointer) {
        #if DEBUG
            CLSNSLogv(format, args)
        #else
            CLSLogv(format, args)
        #endif
    }
}

extension Answers: AnswersProtocol { }
  1. Create the CrashlyticsRecorder and AnswersRecorder shared instances in your AppDelegate after setting up Crashlytics.
public func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
    Fabric.with([Crashlytics()])
    CrashlyticsRecorder.createSharedInstance(crashlytics: Crashlytics.sharedInstance())
    AnswersRecorder.createSharedInstance(answers: Answers.self)
}

Requirements

You must have a Fabric account to use Crashlytics and the CrashlyticsRecorder in your applications.

Author

Anthony Miller, [email protected]

License

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

crashlyticsrecorder's People

Contributors

anthonymdev avatar bpoplauschi avatar jettf avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.