Home > Software design >  Is it possible to use Crashlytics with an extension?
Is it possible to use Crashlytics with an extension?

Time:10-23

There's some existing questions and info dotted around about this (for example How to use Crashlytics with iOS / OS X today view extensions?) but they are very very old, using APIs that no longer exist, have contradictory information, and generally a mess.

My question is simple - is it possible to run Crashlytics in an extension? Specifically a notification service extension?

If anybody has any up to date step by step instructions I'd be grateful. I've tried a few experimentations but nothing working. But actually I don't see how it could actually even work - because crashes in an app are uploaded to the dashboard next time the app runs. But how would an app know that a crash occured within an extension if Crashlytics was added to the extension? If the app and the extension are using a shared group then crashlytics info could be shared between the extension and the app via a file in the group, and yet in none of the answers/references regarding regarding crashlyics/extensions is this aspect ever mentioned.

CodePudding user response:

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.

  • Related