How to Use Crashlytics with iOS/Os X Today View Extensions

How to use Crashlytics with iOS / OS X today view extensions?

Crashlytics support got in touch with me and provided these steps. I tested them and it now works for me iOS 8 app.

  1. Add the Crashlytics Run Script Build Phase to your extension's target as well (copy / paste the same you added to your main app)

  2. Add the Crashlytics.framework to your extension's linked libraries
    (e.g. simply check the extension target in its file inspector)

  3. Add the Crashlytics.startWithAPIKey("yourApiKey") to your extension's view controller's initWithCodermethod. (In Apple's today extension template it is called TodayViewController by default)

    > if you have no initWithCoder method yet, it should look like this afterwards:

    required init(coder aDecoder: NSCoder) {
    super.init(coder: aDecoder)
    Crashlytics.startWithAPIKey("yourApiKey")
    }

Is it possible to use Crashlytics with an extension?

I've successfully done it for extensions, but it is tricky (and I don't know if it's officially supported). You're right the main app doesn't know when an extension crashes, so you need to make sure you start Crashlytics from the extension when the process starts. For NSE, I start it in the didReceive(:) function since that's the starting point of the process.

Each extension also has it's own separate Google-Info.plist file so it's reported separately from the main app.

How to use Crashlytics with iMessage Extensions?

Mike from Fabric here.

We have experimental support for only Crashlytics on iMessage Extensions. To get things working:

  1. Add your Fabric Run Script Build Phase to your extension's
    target. Copy and paste the one in your main app.
  2. Add the Fabric and Crashlytics.framework to your extension's
    linked libraries
  3. Add the Crashlytics.startWithAPIKey("YourActualApiKey") to your
    extension's view controller's initWithCodermethod. If you don't
    have an initWithCoder method currently, it should look like this
    in the end:

    required init(coder aDecoder: NSCoder) {
    super.init(coder: aDecoder)
    Crashlytics.startWithAPIKey("yourApiKey")
    }

Reference: https://stackoverflow.com/a/27153383/3975963



Related Topics



Leave a reply



Submit