Ionic framework 为什么Crashlytics函数没有定义?
我已经在我的爱奥尼亚2项目中安装了cordova fabric插件。之后,我在FabricHandlerError中扩展了IonicHandlerError(代码如下)。问题是,当缓存的错误到达时,Crashlytics被定义,所有函数都出现在控制台中,但当您使用它时,它们是未定义的Ionic framework 为什么Crashlytics函数没有定义?,ionic-framework,ionic2,crash,crashlytics,google-fabric,Ionic Framework,Ionic2,Crash,Crashlytics,Google Fabric,我已经在我的爱奥尼亚2项目中安装了cordova fabric插件。之后,我在FabricHandlerError中扩展了IonicHandlerError(代码如下)。问题是,当缓存的错误到达时,Crashlytics被定义,所有函数都出现在控制台中,但当您使用它时,它们是未定义的 import {Injectable} from "@angular/core"; import {IonicErrorHandler } from 'ionic-angular'; import { Crashl
import {Injectable} from "@angular/core";
import {IonicErrorHandler } from 'ionic-angular';
import { Crashlytics } from '@ionic-native/fabric';
@Injectable()
export class FabricErrorHandler extends IonicErrorHandler {
constructor (public crashlytics: Crashlytics) {
super();
}
handleError(error: any): void {
console.log('In Fabric Error Handler');
console.log(error);
this.crashlytics.addLog(error.message);
this.crashlytics.sendCrash();
console.log('Crashlytics Sended. Error message: '+ error.message);
super.handleError(error);
}
}
在控制台中,在处理程序中停止错误:
this.crashlytics
Crashlytics {}
__proto__: IonicNativePlugin
addLog: ƒ ()
constructor: ƒ Crashlytics()
recordError: ƒ ()
sendCrash: ƒ ()
sendNonFatalCrash: ƒ ()
setBoolValueForKey: ƒ ()
setFloatValueForKey: ƒ ()
setIntValueForKey: ƒ ()
setStringValueForKey: ƒ ()
setUserEmail: ƒ ()
setUserIdentifier: ƒ ()
setUserName: ƒ ()
__proto__: Object
this.crashlytics.addLog('ERROR TESTING');
undefined
this.crashlytics.sendCrash();
undefined
你是如何初始化插件的?