我已经实现了 Firebase带有 ionic 3 应用程序的插件。它工作正常。你能告诉我如何使用 Crashlytics用这个插件?根据文档,它似乎适用于 native 应用程序。那么我们如何使用 Ionic 3 来实现呢?
有一个插件cordova-fabric-plugin我们可以将其与 ionic 应用程序一起使用。但似乎我们不再需要它了,因为 native 应用程序文档上有这条注释:请提供任何指导?
Note: If you're upgrading from Fabric Crashlytics, remove the Fabric API key from your AndroidManifest.xml. Delete the key's meta-data tag, which should have io.fabric.ApiKey and the API key.
最佳答案
理论上,您应该按照描述设置 FabricPlugin。 (firebase 所需的版本低于曾经包含的版本)
要在 ionic 上设置,我建议阅读以下问题:https://github.com/sarriaroman/FabricPlugin/issues/70
简短版本:然后创建自定义错误处理程序
{provide: ErrorHandler, useClass: FabricErrorHandler},
然后是您的自定义错误处理程序
import {Injectable} from "@angular/core";
import {IonicErrorHandler } from 'ionic-angular';
import * as stacktrace from 'stacktrace-js';
@Injectable()
export class FabricErrorHandler extends IonicErrorHandler {
constructor (public analytics: Analytics) {
super();
}
handleError(error) {
window.fabric.Crashlytics.addLog('crash triggered');
stacktrace.get().then(
trace => window.fabric.Crashlytics.endNonFatalCrash(error.message, trace)
);
super.handleError(error);
}
}
关于firebase - 带有 Ionic 3 应用程序的 Crashlytics,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49429680/